Allan,
I'm pretty sure you don't have to go through the eval to do what you're trying to do. Can't you just build the regex straight like that, with the $str?
if ($line =~ /$str/) {...}
or am I just imagining things because it's 3:30 in the morning?
- M
On Tuesday, Feb 25, 2003, at 03:03 America/New_York, allan juul wrote:
hi-
perl question
eh, is not possible to get the values in parens when you do a reg match on an
evaled string ?
consider the snippt below, how do i get the values into $1, $2 etc ...
my $str = /(.{11})(.{10})/i; my $line = "test string etc etc test string"; if ($line =~ eval("/" . $str . "/")) { print "id = $1\n"; print "pw = $2\n"; }
thanks ./allan
"Thus nature has no love for solitude, and always leans, as it were, on some support; and the sweetest support is found in the most intimate friendship." - Cicero