J
jilerner
I'm looking for the solution with s/from/to/ when the to-part
comes from ARGV and references the $1. I tried /e and /ee
but still can't get this right.
Here's simlpified example. I need to get equivalent
of s/(.)/($1)/g , the difference being that the (the ($1))
comes from the variable: $to='($1)';
$_="abc"; s/(.)/($1)/g; # this does what I want -> "(a)(b)(c)"
$to='($1)';
$_="abc"; s/(.)/$to/g; # does not do what I want, I want result to be
"(a)(b)(c)"
$_="abc"; s/(.)/$to/ge; # does not do what I want
$_="abc"; s/(.)/$to/gee; # does not do what I want
Yakov
comes from ARGV and references the $1. I tried /e and /ee
but still can't get this right.
Here's simlpified example. I need to get equivalent
of s/(.)/($1)/g , the difference being that the (the ($1))
comes from the variable: $to='($1)';
$_="abc"; s/(.)/($1)/g; # this does what I want -> "(a)(b)(c)"
$to='($1)';
$_="abc"; s/(.)/$to/g; # does not do what I want, I want result to be
"(a)(b)(c)"
$_="abc"; s/(.)/$to/ge; # does not do what I want
$_="abc"; s/(.)/$to/gee; # does not do what I want
Yakov