Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 pondering the Monastery: (8)
As of 2014-12-22 07:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (112 votes), past polls