Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: multiple local vars in a foreach loop

by LanX (Saint)
on Jan 31, 2013 at 08:40 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1016253]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2024-04-23 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found