Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Re: Not Using So Many 'if' Statements

by insensate (Hermit)
on Jan 09, 2003 at 20:40 UTC ( [id://225639]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Not Using So Many 'if' Statements
in thread Not Using So Many 'if' Statements

Right... last will break me out of my loop... but why not just exit as soon as I've accomplished the purpose of the script instead of adding an extra command?

Update: Here's what I mean:
Adding the last statement would require an additional conditional:
my $success; for(@host){ $stout = run($_); unless($stout == 256) { $success++; last; } print "$_ not responding, trying next host\n"; } print "all hosts not responding" unless $success;

Replies are listed 'Best First'.
Re: Re: Re: Re: Not Using So Many 'if' Statements
by CountZero (Bishop) on Jan 09, 2003 at 20:46 UTC

    Indeed, no reason why you should not use exit to kill the program if you're done. I was just pointing to the side-effects of exit: you may get more more than you bargained for.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://225639]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-19 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found