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

I usually just go

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

ihb

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