Just another Perl shrine | |
PerlMonks |
Re: hash as subroutine argumentby davorg (Chancellor) |
on Jul 02, 2009 at 13:16 UTC ( [id://776740]=note: print w/replies, xml ) | Need Help?? |
Well, yes it's possible to do it using something like your approach. Your file_merge() subroutine would look like this:
But actually, that's not right as you're reading from the default filehandle each time. I'd do this completely differently.
You would then call it like this:
Another (perhaps better) alternative would be to return a hash reference rather than a hash. As always strict and warnings will point out some of the major problems with your code.
In Section
Seekers of Perl Wisdom
|
|