in reply to Re: regular expression problem
in thread regular expression problem
Rather than use eval inside the replacement term you can use a double ee modifier (see the s operator in Regexp Quote Like Operators).
$ perl -le ' > $str = q{10 09}; > $reg = q{(\d+) (\d+)}; > $rep = q{"$2 $1"}; > $str =~ s/$reg/$rep/ee; > print $str;' 09 10 $
I hope this is of interest.
Cheers,
JohnGG
|
|---|