RE: Subroutine Syntax

2003-06-15 Thread Kristofer Hoch
David, I the reason this worked for Scot and not you is something that is both simple and EASILY OVERLOOKED. Consider the lines. #Scot if ($_ == 1) { ^^---> Scot is using a comparison operator #David if ($_[0]=1) { ^--> You are using an assignment operator. So in ef

Re: Subroutine Syntax

2003-06-15 Thread Greenhalgh David
: : < DO STUFF> Comments in perl begin with #, not < Perl probably thinks you're referring to a file handle in angle brackets. Sorry, this is me using my own shorthand, everything is correctly #'d in the code. : sub error { : : : : if ($_[0]=1) { '=' is an assignment operator. You

RE: Subroutine Syntax

2003-06-15 Thread Charles K. Clarkson
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

RE: Subroutine Syntax

2003-06-14 Thread Scot Robnett
This worked for me. #!/usr/bin/perl -w use strict; use CGI; my $cgi = new CGI; print $cgi->header(-title=>'Hi there'); print $cgi->h3('What\'s up'); print qq(\n); my $status = 0; my $i = 0; for($i=0; $i<3; $i++) { if($status) { error($status); } $status++; } sub error { print $cgi->p