Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: Passing array and hash together

by linuxer (Curate)
on Apr 20, 2009 at 20:56 UTC ( #758795=note: print w/replies, xml ) Need Help??

in reply to Passing array and hash together : Solved

Please use <code></code> tags to format your code.

In routine_2 your hash reference is stored as the last element in @array.

quoted from perldata

The final element of a list assignment may be an array or a hash: ($a, $b, @rest) = split; my($a, $b, %rest) = @_; You can actually put an array or hash anywhere in the list, but the fi +rst one in the list will soak up all the values, and anything after it will become undefin +ed. This may be useful in a my() or local().

You must decide now, whether to pass the array as last argument to routine_2 or to pass a reference to that array and then use that reference in your subroutine. I'd use the second option. ;o)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://758795]
[RonW]: My daughter and I like to "fly" Flightgear. What ever aircraft we pick, she usually shoots me out of the sky
[Corion]: Oooh. I didn't know about Flightgear. I've been looking at maybe playing with a flight simulator again, thanks!

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2017-02-27 18:14 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (390 votes). Check out past polls.