From: Robert Hicks <[EMAIL PROTECTED]>
> Is there anything wrong with:
> 
> if ( defined $one && defined $two && $one eq $two ) {
>     #### do something
> }

As far as I can tell not. I was afraid the operator precedence might 
play tricks with it, but looks like it doesn't:

V:\>perl -MO=Deparse -e "defined $one && defined $two && $one eq 
$two"
$one eq $two if defined $one and defined $two;
-e syntax OK

V:\>perl -MO=Deparse -e "if(defined $one && defined $two && $one eq 
$two) {print 'aha'}"
if (defined $one and defined $two and $one eq $two) {
    print 'aha';
}
-e syntax OK

I would write it as 

  if ( defined($one) && defined($two) && $one eq $two ) {

or even more likely as 

  if ( defined($one) and defined($two) and $one eq $two ) {

but it seems your version is just fine.

Jenda

===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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


Reply via email to