in reply to how to loop

Hi Reagen, You might want to use a 'do while', which works like this:

$a=0; do { print $a++, "\n" } while ($a < 10)

Because it checks the condition at the end, it'll run the loop once through even if the condition is false to begin with (try changing the condition to $a < -10 and you'll see what I mean).

You can find out more in the docs under perlsyn. HTH!

Best wishes, a.

Replies are listed 'Best First'.
Re^2: how to loop
by geekphilosopher (Friar) on Feb 21, 2007 at 19:57 UTC
    Be careful though - you can't use loop directives (next, last, redo, etc.) in a do while.