Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: can we pass two variable to foreach loop

by bobf (Monsignor)
on Mar 28, 2007 at 05:45 UTC ( #606915=note: print w/ replies, xml ) Need Help??


in reply to can we pass two variable to foreach loop

No, but you can use a list of references to hashes or arrays that contain multiple values:

my @AoH = ( { firstname => 'foo', lastname => 'bar' }, { firstname => 'baz', lastname => 'quux' } ); foreach my $href ( @AoH ) { # do something with $href->{firstname} and $href->{lastname} }


Comment on Re: can we pass two variable to foreach loop
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-10-23 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls