carbonettis has asked for the wisdom of the Perl Monks concerning the following question:
But it looks like not working and I cannot find the reason. Any ideas? when I run it it returns "syntax error at ex4HW01.pl line 13, near "0;" THANKS!#!/usr/bin/perl -w $check = mycheck($#ARGV); if ($check != 1) { $usage = "Help arguments have been found"; print $usage, "\n"; } sub mycheck { my($#ARGV) = @_; $return = 0; #Variable RETURN set as false (set as 0) foreach $arg (0 .. $#ARGV) { if (($arg eq '-help') || ($arg eq '-h') || ($arg eq '--help')) + { $return = 1; #Variable return now is true exit; } else { print "No help arguments found\n"; } } return $return }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: ARGV issue
by ikegami (Patriarch) on Oct 02, 2011 at 21:57 UTC | |
|
Re: ARGV issue
by TomDLux (Vicar) on Oct 03, 2011 at 02:39 UTC | |
|
Re: ARGV issue
by jwkrahn (Abbot) on Oct 02, 2011 at 22:24 UTC | |
|
Re: ARGV issue
by dwm042 (Priest) on Oct 03, 2011 at 17:56 UTC |