Am Freitag, 29. April 2005 14.43 schrieb [EMAIL PROTECTED]:
> So which is safer more ideal to use :   || , or
>
>
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
[...]

The only difference between "||" and "or" is the precedence, and the 
precedence of "=" lies between them.

To my understanding, in the "assign or die" special case,

 my $a=do_something_which_can_fail() or handle_exception();

is more logic than

 my $a=do_something_which_can_fail() || handle_exception();

because something should be assigned to $a, and if that fails, the app should 
e.g. die. This way, the exception handling is not part of the assignement.

On the other side, I would use 

 my $a=do_something_which_can_fail() || provide_some_default();

because the exception handling consists of providing a value.

Just my personal way to look at it :-)

joe

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to