david Greenhalgh <[EMAIL PROTECTED]> asked: : : Been banging my head on this, I'm obviously missing : something obvious, but I can't see what. Would someone : put me out of my misery? : : My code checks the value of a variable $status. : $status can have three values, 0,1,2. 0 is good, 1 : and 2 are errors. So: : : use strict; : : if ($status) { : error($status); : } : : < DO STUFF>
Comments in perl begin with #, not < Perl probably thinks you're referring to a file handle in angle brackets. : sub error { : : <Print top half of a HTML page> : : if ($_[0]=1) { '=' is an assignment operator. You're testing if $_[0] can be set equal to 1. Guess what? It can! It will always be true. if ( $_[0] == 1 ) { : <print rest of the page with the error 1 message> : } : else { : <print rest of the page with the error 2 message> : } : } : : With all of the sub definition commented out the code : checks OK with perl -cT (Q. should that happen if I : call a sub that I comment out when I'm using strict?) -c checks syntax, it doesn't check to see if the error sub was defined. : But with the sub definition back in, perl -cT throws : up a syntax error at sub error {, The previous line doesn't end with ';'. : and another syntax error at if($_[0]=1){ This is because warnings is on (see above). HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]