in reply to Re: Passing globals and magic variables safely
in thread Passing globals and magic variables safely

Me too. In production code, I almost never use the regex variables except in a s///. Note that it is pretty easy to combine this with checking for successful match:
my ($foo, $bar); unless (($foo, $bar) = $data =~ $pattern) { die "horribly!"; } ...

Replies are listed 'Best First'.
Re^3: Passing globals and magic variables safely
by ihb (Deacon) on Apr 10, 2005 at 23:23 UTC

    I usually just go

    my ($foo, $bar) = $data =~ /$pattern/ or die "horribly!";

    ihb

    See perltoc if you don't know which perldoc to read!