in reply to Re: hex code passed from command line is interpreted literally in substitution
in thread hex code passed from command line is interpreted literally in substitution

thanks, this works:
$var = 'a'; $arg_2 =~ s@\\x([0-9]+)@pack("H*", $1)@ge; $var =~ s@$arg_1@$arg_2@; # works now print "$var\n";
Two things I am wondering though,

1) why is this not needed on the search pattern?

2) what other kinds of surprises might I expect in passing regexes on the command line?
  • Comment on Re^2: hex code passed from command line is interpreted literally in substitution
  • Download Code

Replies are listed 'Best First'.
Re^3: hex code passed from command line is interpreted literally in substitution
by ikegami (Patriarch) on Mar 06, 2011 at 00:43 UTC

    why is this not needed on the search pattern?

    The regex is compiled after interpolation.

    what other kinds of surprises might I expect in passing regexes on the command line?

    You just asked why there was no surprise with the regex.