Path: utzoo!attcan!uunet!husc6!purdue!haven!uvaarpa!mmdf From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.perl Subject: $! and string context Message-ID: <1990Jul13.175014.1750@uvaarpa.Virginia.EDU> Date: 13 Jul 90 17:50:14 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: worley@compass.com Organization: The Internet Lines: 24 People might be interested to note that the conditional expression in an 'if' is a string context, which I didn't expect. The string/numeric context difference seems to usually be unimportant, but $! is an exception: die "Can't do ..." if $!; does not work, since if there is no error, $! in a string context will give 'Error 0', which tests TRUE. For another example, run the program: $a = $! + 0; print "numeric is $a\n"; print "string is $!\n"; if ($!) { print "tests TRUE\n"; } else { print "tests FALSE\n"; } Dale Worley Compass, Inc. worley@compass.com -- Don't go around saying the world owes you a living. The world owes you nothing. It was here first. -- Mark Twain