Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Passing a hash between subs

by Coruscate (Sexton)
on Jan 30, 2003 at 16:58 UTC ( #231379=note: print w/replies, xml ) Need Help??

in reply to Passing a hash between subs

I know that this may not help you with the problem you've posted, but it is something that can become important. Then I'll nitpick one smaller thing.

Your last line of the bar() sub is return %locations, so you are copying the data structure over to the foo() sub. This might take up a few extra cycles if the hash is quite large, so you might want to consider passing by reference instead. Change that last bar() line to return \%locations;, that first line of foo() to my $locations = bar($dbh);, and then dereference $locations to get at the values. My little nitpick is getting rid of the '&' symbol that is part of your call to foo(). Nasty, nasty, nasty (:

      C:\>shutdown -s
      >> Could not shut down computer:
      >> Microsoft is logged in remotely.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2021-05-11 17:24 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (120 votes). Check out past polls.