in reply to SOLVED Printing last two characters

I wouldn't use a regexp, I'd use substr:
print substr "1234,Dr,Huxtable,Cliff,M,24/12/1976,60", -2, 2; #Output: 60

The second argument is the start position, with negative numbers mean from the end of the string and the third argument is how many characters to extract.

Replies are listed 'Best First'.
Re^2: Printing last two characters
by ikegami (Patriarch) on Jan 03, 2008 at 12:10 UTC

    Note that
    substr($str, -2, 2)
    can also be written as
    substr($str, -2)
    since substr defaults to extracting the rest of the string.