Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: foreach to for

by ioannis (Parson)
on Jun 19, 2006 at 09:07 UTC ( #556207=note: print w/ replies, xml ) Need Help??

in reply to foreach to for

As shown bellow, the first for loop produces fixed iterations, and the second dives into infinite loop. Although expectations are not consistent, at least you get to chose which method to want.

## Fixed-length Loop my $i=6; for (0..$i) { print ; $i++; } #### Infinite Loop my @nums = 1..3; for (@nums) { push @nums, $_; print; }

Comment on Re: foreach to for
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2016-02-11 11:38 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (368 votes), past polls