in reply to Strange Regex Behavior
Intriguing. If you quote the $1, you get the expected output. Quite what that tells us I'm not sure.
Update: this also works:
a => ($b =~ /(\d+)/ ? 0+$1: 0),
As does this:
a => ($b =~ /(\d+)/ ? do{ print $1; $1 }: 0),
But not this:
a => ($b =~ /(\d+)/ ? do{ $1 }: 0),
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strange Regex Behavior
by Manchego (Acolyte) on Dec 06, 2011 at 05:58 UTC | |
by BrowserUk (Patriarch) on Dec 06, 2011 at 06:11 UTC |