S
SamL
I want to use a variable as a regular expression because I want user
to be able to specify the regular expression in command line.
Basically I want something like this:
perl -e '$pattern='s/a/b/'; $x='a'; $x=~$pattern; print $x;'
where user can modify $pattern at runtime.
Of course the above does not work. I am wondering if there is some
mechanism in perl allowing me to do that. For example, something like
eval in ksh.
Thanks.
to be able to specify the regular expression in command line.
Basically I want something like this:
perl -e '$pattern='s/a/b/'; $x='a'; $x=~$pattern; print $x;'
where user can modify $pattern at runtime.
Of course the above does not work. I am wondering if there is some
mechanism in perl allowing me to do that. For example, something like
eval in ksh.
Thanks.