if ( defined($foo) and $foo eq '?' ) { print "\$foo OK!\n"; } #### print "\$foo OK!\n" if $foo and $foo eq '?';