if (defined($wbits)) { print "\$wbits is defined: ",Dumper($wbits); if($wbits =~ /[^\0]/) { print "\$wbits matched\n"; ... } else { print "\$wbits did not match\n"; } }