in reply to Re: Re^4: Shifty Politics
in thread stoping and restarting a loop
You can do that with shift, sure, but it's not as concise.sub fooge { my ($foo, $bar, @baz) = @_; # ... if ($foo->isa('Acme::Frobnicator')) { die "Missing 'baz' parameter to fooge()\n" unless (@baz); $foo->frob(@baz); # ... } # ... }
You'll note that shift is more verbose, and also permanently modifies @_. I'd rather have it there intact for debugging purposes. For example:sub fooge { my ($foo, $bar) = (pop, pop); }
sub blarg { my ($foo, $bar, $bork) = @_; # ... if (computer_is_on_fire()) { die "Apocalyptic end of blarg(@_)\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^6: Shifty Politics
by BrowserUk (Patriarch) on Sep 10, 2002 at 19:38 UTC | |
by tadman (Prior) on Sep 10, 2002 at 22:23 UTC | |
by BrowserUk (Patriarch) on Sep 10, 2002 at 23:00 UTC | |
by tadman (Prior) on Sep 11, 2002 at 01:36 UTC |