[oak perl] until loop(s)
Mark Bole
mark at bincomputing.com
Mon Mar 28 18:52:48 PST 2005
Fellow perlmongers:
It's hard to get a jump on this list! I first saw Sandy's original post
a few minutes after it originated, and while I was testing some code in
response, suddenly there are three responses already!
<ot_rant>
My excuse is, I was busy today wrestling with Yahoo! Domains (reseller
for Melbourne IT), they basically force you to cancel all service and
support, just to transfer to another domain registrar, essentially
holding your web site hostage for up to five days. Thank goodness this
time I'm handling a non-profit domain that is seasonal in nature and so
can afford such an extended outage. But what a rip-off! Anyone else have
similar trials and tribulations?
http://it.slashdot.org/article.pl?sid=05/01/16/0027213
http://www.dnforum.com/showthread.php?t=84483
</ot_rant>
Now, reviewing the previous replies, I think the only new thing of value
I can add is,
"Don't use '$counter == 5' as a loop termination condition"
You never know when your code will be called (or otherwise altered) by
other code that somehow just by the sheerest of coincidences decides to
handle '$counter == 5' as a special case and sends you back '$counter ==
6'. Use "$counter >= 5" instead.
If at all meaningful, loops should have a guaranteed exit. As a last
resort, if you hard-code a failsafe limit, provide a command-line option
to override it.
Sandy, did anyone achieve world peace in your testing? :-)
--
Mark Bole
http://www.bincomputing.com
925-287-0366
Sandy Santra wrote:
> I'm learning (struggling with) "until" loops today. I want an "until"
> control structure that "breaks out" when a condition is fulfilled.
>
> Can anyone find the problem in the below loop? (It never breaks
> out.) Thanks.
>
> [...]
> until (my $counter == 5)
> [...]
> --Sandy Santra
>
> _______________________________________________
> Oakland mailing list
> Oakland at pm.org
> http://mail.pm.org/mailman/listinfo/oakland
>
>
More information about the Oakland
mailing list