in reply to Re: Re: Re: Applying a RegEx in a variable
in thread Applying a RegEx in a variable
Well, you can always do it the qr// way (this is better anyway if you are using the same regex more than once). Or you can do it along these lines:
The code executed within the eval has access to the variables outside - again it works the same way as if the evaluated code was in a code block of its own.my $match; eval "\$String =~ $RegEx"; \$match = \$&"; print $match;
-- Hofmator
|
|---|