Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: passing multiple hashes to a subroutine

by anneli (Pilgrim)
on Oct 20, 2011 at 21:13 UTC ( #932756=note: print w/ replies, xml ) Need Help??


in reply to passing multiple hashes to a subroutine

Avoid prototypes unless you really need to use them; they're not like argument/parameter lists in other languages (frankly I think your use here will confuse anyone reading your code!).

Instead, just pass references to the hashes. Thus:

sub count_orientation { my $ref = shift; my %x = %{(shift)}; # this is still correct! my $y = %{(shift)}; # ... } count_orientation($x, \%error_start, \%score); # or: count_orientation($x, {%error_start}, {%score});


Comment on Re: passing multiple hashes to a subroutine
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://932756]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (6)
As of 2015-07-02 00:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (25 votes), past polls