Is there anything wrong with: if ( defined $one && defined $two && $one eq $two ) { #### do something }