[oak perl] until loop(s)

Kester Allen kester at gmail.com
Mon Mar 28 13:12:53 PST 2005


Hi Sandy--

In addition to the good advice you've already gotten, I've always
found "until" loops and "unless" blocks to be more confusing than
they're worth.  You could combine your until and while loops into a
single loop like this:

my ( $number, $counter ) = ( 9, 0 );
while ( ($counter++ < 5) && ($number = <STDIN>) ) {
    chomp $number;
    print "number = $number, counter = $counter.\n";
}

which might be easier to read.

--Kester


More information about the Oakland mailing list