[sf-perl] a reason to goto

Neil Heller nheller at silcon.com
Sat Feb 24 18:55:15 PST 2007


In addition to a performance hit (which can be significant, depending on the
memory requirements of the recursive function) you might also run into a
trashing scenario.  Buying new hard disks can get expensive and reinstalling
all your software can suck.


Neil Heller
nheller at silcon.com


-----Original Message-----
From: sanfrancisco-pm-bounces+nheller=silcon.com at pm.org
[mailto:sanfrancisco-pm-bounces+nheller=silcon.com at pm.org] On Behalf Of
David Alban
Sent: Saturday, February 24, 2007 1:10 PM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] a reason to goto


What about making a subroutine out of it, to which you pass $REFLEXIVE (and
maybe $i and $j)?  If after calling pick_numeric( ... ) $REFLEXIVE doesn't
have the value you want, you recursively call the subroutine?  I know some
folks don't like recursion, and if you anticipate a large number of
recursive calls it could be a performance issue, but I thought I'd ask.

On 2/24/07, Joe Brenner <doom at kzsu.stanford.edu> wrote:
> I found a reason to use a goto!
>
>   if ($RANDOMIZE) {
>     DO_OVER: do {
>       $i = pick_numeric(0, $numb_cards-1);
>       $j = pick_numeric(0, $numb_cards-1);
>       unless( $REFLEXIVE ) {
>         if ($i == $j) {
>           goto DO_OVER;
>         }
>       }
>     };

-- 
Live in a world of your own, but always welcome visitors.
_______________________________________________
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org http://mail.pm.org/mailman/listinfo/sanfrancisco-pm





More information about the SanFrancisco-pm mailing list