Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Perlplexation - foreach shoulda Known

by raybies (Chaplain)
on Apr 13, 2012 at 19:41 UTC ( [id://964975]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @x = (1..10);
    foreach (@x) {
    ...
    
    OUTPUT: 
    101 102 103 104 105 106 107 108 109 110
    
  2. or download this
    
    my @x = (1..10);
    ...
    
    OUTPUT: 
    101 102 103 104 105 106 107 108 109 110
    
  3. or download this
     map {$_ += 100} @x;
    
    (yields same output and alters @x as does...)
    ...
    in case you wondered... :)
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://964975]
Approved by davido
Front-paged by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found