Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

RE: Number of times I've used goto in Perl

by chromatic (Archbishop)
on Apr 19, 2000 at 00:21 UTC ( #7968=note: print w/replies, xml ) Need Help??

in reply to Number of times I've used goto in Perl

Does a named loop count? Something like:
TOP_OF_LOOP: while (1) { # do this for (1 .. $some_big_number) { $foo = do_some_function($_); if ($foo % $_ = $some_smaller_number) { next TOP_OF_LOOP; } # do something else } } }
In both cases, your program flow probably needs help. :) (Okay, I'm really bad with configuration files.)

(And, yes, okay, it's an implicit goto. I'm guilty of it once in an AUTOLOAD, though.)

Replies are listed 'Best First'.
RE: RE: Number of times I've used goto in Perl
by turnstep (Parson) on Apr 19, 2000 at 00:42 UTC
    Where is the goto in your example?
RE: RE: Number of times I've used goto in Perl
by cciulla (Friar) on Apr 19, 2000 at 02:24 UTC
    IMHO, breaking flow using 'next' counts.

    That's almost as bad as an infinite 'while(true)' construct! :)
      What's so bad about while (1) { something; next if somethingmore; last if somethingelse; } ?

      I use it all the time.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://7968]
[LanX]: xD ... complicated countrie(s)
LanX reigned by the Duke of Normandy
[davies]: LanX: Politicians making jobs for each other, really. Results in unnecessary complications and tax bills with up to 5 levels of Govt busily inventing new crimes for people to commit.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-12-15 18:25 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (441 votes). Check out past polls.