Did you test this? It doesn't work on my system.
C:\test>type fred.pl $exp = qr|^DMSC0022\s+\S+\s+(\w+)$|; $str = 'Logfile_Connection_Lost Hostname: $1'; # note that you have to + use single quotes or the $1 is interpolated as soon as you de fine $str, not when you eval() the string (which is completely superfl +uous) $_ = "DMSC0022 X10 oswald"; if ($exp) { print eval $str; # *now* get $str to interpolate } C:\test>fred Use of uninitialized value in print at C:\test\fred.pl line 6. C:\test>
In reply to Re: Re: Regex frustration
by BrowserUk
in thread Regex frustration
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |