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:
say "-->$string<--";
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:
-->hello world <--
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; --output:-- 92.120.50.49.104.101.108.108.111
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing Last Element of a line using perl memory?
by BrowserUk (Patriarch) on Feb 15, 2013 at 01:27 UTC | |
by 7stud (Deacon) on Feb 15, 2013 at 01:44 UTC |