in reply to Re: Problems evaluating a user supplied regex using eval (boo)
in thread Problems evaluating a user supplied regex using eval
So since eval is scoped to it's block, then am I correct in assuming I could do something along the lines of
eval { $my_text =~$regex # where $regex is m/ab|(cd)/ for example print $&; print $1, $2 # if defined }
and then $& will hold the value of the match, and $1 and $2 will be accessable?
My understanding of this, and please correct me if I'm wrong, is that since eval is dynamically scoped, as long as my code is blocked between {} I'm okay.
|
|---|