in reply to SOLVED Printing last two characters

The best solution using substr was already posted, so let me just add an explanation why m/\Z{2}/ doesn't work.

\Z matches not a character, but a position. So it's useless to say "match end of the string, and then again end of the string".

With warnings enabled perl would have told you:

Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in m/\Z{2} <-- HERE / at -e line 1.