Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: passing multiple hashes to a subroutine

by itsscott (Sexton)
on Oct 20, 2011 at 19:26 UTC ( #932734=note: print w/replies, xml ) Need Help??


in reply to passing multiple hashes to a subroutine

I asked the same thing once too here's the answer I used to great success. http://www.perlmonks.org/?node_id=903429 And a small snippet from my working code.
sub report { our %hash1; local *hash1 = $_[0]; our %hash2; local *hash2 = $_[1]; our %hash3; local *hash3 = $_[2]; my $othervar1 = $_[3]; my $othervar2 = $_[4]; ... do stuff ... } # call it report(\%hash1, \%hash2, \%hash3, $othervar1, $othervar2);
Hope that helps

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://932734]
help
Chatterbox?
[1nickt]: Hm well actually I guess it's not the trailing semi-colon that's at issue there, it's disambiguation between the ellipsis and the binary flip-flop
[1nickt]: Although the example given does not produce an error as stated, on my perl.
[1nickt]: perl -wE 'say for map { ... } 1..3;' # "Unimplemented at -e line 1" ... <c>perlsyn says that should throw a syntax error...
[karlgoethebier]: 1nickt: "Edge cases..." Yes, it seems so. Thanks Nick

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2017-11-18 19:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (277 votes). Check out past polls.

    Notices?