foobar({ -foo => 'FOO', -bar => 'BAR' }); sub foobar { my ($foo, $bar) = @{shift(@_)}{qw/ -foo -bar /}; print "\$foo => $foo, \$bar => $bar\n"; }