Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Using an array element as a loop iterator

by Eily (Monsignor)
on Nov 07, 2013 at 18:15 UTC ( [id://1061609]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for each element in @b
       $a[1] = element
       print $a[1]
    done
    
  2. or download this
    @a = (1,2,3);
    @b = (2,4,6,7);
    print for @b[@a]; # print for elements of @b with indexes in @a
    
  3. or download this
    @a = (1,2,3);
    @b = (2,4,6,7);
    for $i (@a)
    {
       print $b[$i];
    }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-25 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found