Gossamer Forum
Home : General : Perl Programming :

question on the "&&" operator in PERL

Quote Reply
question on the "&&" operator in PERL
in a line of code i was researching, i came across this line:

$myObj && return $myObj;
//more code follows

what does this mean or do? i know it does something because when i took it out, certain values from one instance of the object did not add up with the other instance's values (which is what i want).
Quote Reply
Re: [deryk] question on the "&&" operator in PERL In reply to
&& is the logical and operator[1]. What is on the right of the operator only gets evaluated if the left evaluates true. That line means: Return myObj only if it is defined.

~Charlie

[1] http://perldoc.perl.org/...#C-style-Logical-And