On Wed, Jul 27, 2011 at 9:30 AM, Rob Dixon <[email protected]> wrote:
> What exactly is wrong with "or do {...}"?
>
> I believe it is the best option simply because is is comparable to the
> common "open ... or die $!" idiom. The do is there only so that a
> warning can be issued as well as the return
There's nothing wrong with issuing an "or do {...}" especially if you
want to do multiple things on failure.
open(my $fh, '<', $somefile) or do {
log_the_error("Could not open $somefile - $!");
do_something_else();
return;
};
Kevin.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/