in reply to Re: Regex frustration
in thread Regex frustration
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>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Regex frustration
by diotalevi (Canon) on Sep 25, 2002 at 02:16 UTC |