$a = 123; print $a =~ m/^\d+$/, "\n"; $a = "abc"; $ret = ($a =~ m/^\d+$/); if (defined($ret)) { print "=$ret=\n";#print out == } else { print "undef";#not going this loop } #### sub true_false { if (shift()) { print "true\n"; } else { print "false\n"; } } true_false("a"); true_false(1); true_false(""); true_false(0); if (undef) { #I don't want to use true_false for this case, so it is guranteed that shift() does not play any magic print "true\n"; } else { print "false\n"; }