There's more than one way to do things PerlMonks

### Re: Re: GOTO considered (a necessary) evil?

by Joost (Canon)
 on Jul 16, 2002 at 09:49 UTC ( #182028=note: print w/replies, xml ) Need Help??

in reply to Re: GOTO considered (a necessary) evil?
in thread GOTO considered (a necessary) evil?

If your target label in a goto is undefined, perl won't complain until it tries to actually execute the goto, even when using strict and warnings. If your goto is handling a "once in a thousand years" case, then you're likely not to notice this typo until it's too late.

Ofcourse, you have the same problem if you use a subroutine/method call (though you would probably not use those in the same situation).

Myself, I would prefer

while (1) {
....
....
last unless (EXPR);
}
[download]
Which makes very clear that this is a loop (even though it might not loop more than once 99% of the time) and it "forces" some structure (which is not always a bad thing), and it might make you see the problem from a new perspective - TIMTOWDI after all.
--
Joost       downtime n. The period during which a system
is error-free and immune from user input.
[download]

Create A New User
Node Status?
node history
Node Type: note [id://182028]
help
Chatterbox?
 [Corion]: thezip: If you want to confuse your users, use system(1, "that\\command" );, which will make Perl launch it in the background [Corion]: That will keep the console window open even though the user can't type into it anymore [thezip]: So I have a script that generates a log file. After script completion, I want tohave VIM open this logfile. [thezip]: i don't get the command line "back" until I close VIM. No what I want to happen... [thezip]: I currently don't have access to CYGWIN, else I'd just do a tail -f on the logfile. [Corion]: thezip: If you want to open vim and can live with opening a second console window, use start "The results" vim.exe c:\path\to\logfile .log

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2017-03-27 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should Pluto Get Its Planethood Back?

Results (321 votes). Check out past polls.