perl - extract list of strings
===

dummy.txt contains:

    gflkgWXYZ_123jfdknABC_8723879bfdkh873ABC_456jhb
    gflkUI_12643jfdknABC_bfdk873WXYZ_7848jhb
    ABC_1121fABC_22462
    WXYZ_33273
    3ABC_888

I'm trying to match all of these WXYZ_(optionally numbers) ie WXYZ_23 and ABC_(optionally numbers). ie ABC_

What perl script (i'm running on solaris with no GNU) would allow me to produce the following output file?

    WXYZ_123
    ABC_8723879
    ABC_456
    ABC_
    WXYZ_7848
    ABC_1121
    ABC_22462
    WXYZ_33273
    ABC_888