Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^2: While Loops

by tbone654 (Beadle)
on Jan 08, 2013 at 19:07 UTC ( #1012315=note: print w/ replies, xml ) Need Help??

in reply to Re: While Loops
in thread While Loops

How about something like this?

foreach $a (0..@data-1) { print or do something ; } ## end of foreach

If you have the length of the array it knows then when to stop.

Comment on Re^2: While Loops
Download Code
Replies are listed 'Best First'.
Re^3: While Loops
by kennethk (Abbot) on Jan 08, 2013 at 19:29 UTC
    1. You should not use $a as your index variable, or really ever as a generic variable. $a and $b have special meaning for sort.
    2. I'm unclear on how your strategy splits the array into chunks of 100 records. There are certainly a myriad of ways to get this done, but it's not obvious to me how this is one of them.

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2015-11-28 06:28 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (739 votes), past polls