Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: Printing last two charactersby moritz (Cardinal) |
on Jan 03, 2008 at 11:41 UTC ( [id://660170]=note: print w/replies, xml ) | Need Help?? |
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:
In Section
Seekers of Perl Wisdom
|
|