Chris Nandor wrote:
> 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.
>
As a real newbie I have to ask why should I avoid the eval... Also, in
which situation you would recommend its use, other than trapping otherwise
fatal errors?
--
Giorgio Valoti
Magnetic Media Network <http://www.magneticmedia.com>
-----------------
S/MIME Cryptographic Signature