in reply to Printing Last Element of a line using perl memory?
When you are having trouble with regex matching, and you are certain your regex is correct, then it's time to check exactly what's in the string you're matching. One trick is to do this:
Any trailing whitespace will be apparent:
-->hello world <---
And if there is a newline at the end of the string, you'll see something like this:
Or if you want to reveal every character's ascii code, you can do this:
Edit: the printf applies ord() to the characters, so the printf is not limited to ascii characters.
printf "%vd \n", $string;