At 10:50 +0100 2001.03.05, Bart Lateur wrote:
>eval() should still work.
>
> eval("\$something =~ m/regex/$switch")
My preferred method, FWIW, is:
my $result;
if ($switch eq 'i') {
$result = $something =~ m/regex/i;
} else {
$result = $something =~ m/regex/;
}
if ($result) {
# ...
}
It is a bit more verbose, but it avoids an eval, which is almost always
preferable to me.
--
Chris Nandor [EMAIL PROTECTED] http://pudge.net/
Open Source Development Network [EMAIL PROTECTED] http://osdn.com/
- [MacPerl] Setting regex switch programmaticaly Giorgio Valoti
- Re: [MacPerl] Setting regex switch programmaticaly Bart Lateur
- Re: [MacPerl] Setting regex switch programmaticaly Chris Nandor
- Re: [MacPerl] Setting regex switch programmaticaly Ronald J Kimball
- Re: [MacPerl] Setting regex switch programmatica... Scott R. Godin
- Re: [MacPerl] Setting regex switch programmaticaly Giorgio Valoti
- Re: [MacPerl] Setting regex switch programmaticaly Bart Lateur
- Re: [MacPerl] Setting regex switch programmatica... Giorgio Valoti
- Re: [MacPerl] Setting regex switch programmatica... Chris Nandor
