Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: multiple local vars in a foreach loop

by LanX (Canon)
on Jan 31, 2013 at 08:40 UTC ( #1016253=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      DB<113> @array = (a =>1,b=>2)
     => ("a", 1, "b", 2)
    ...
    
      DB<116> \@array            # emptied! 
     => []
    
  2. or download this
    while(@array) {
       $hash{shift @array} = shift @array;
    }
    
  3. or download this
      DB<108> @array = ( a => 1, b => 2 )
     => ("a", 1, "b", 2)
    ...
    
      DB<110> \%hash
     => { 1 => "a", 2 => "b" }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2015-07-06 06:23 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 (70 votes), past polls