in reply to SOLVED Printing last two characters
\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.
|
|---|