Yes, it's possible. But it depends on what you actually want to do. If you just want to do what you show in your example, then
my %h=@_; # is enough!
But if you also want to modify the hash you pass in, or if you want to pass a few params of which one (or more) happens (happen) to be a hash, then as others already pointed out, you have to use a reference. You can also use a prototype, as explained in perldoc perlsub to have perl doing this for you. But regard that as a somewhat advanced technique and be sure to have understood the docs if you want to apply it...
In reply to Re: pass a hash to subroutine
by blazar
in thread pass a hash to subroutine
by benlaw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |