Re: code help
- From: jammer <jameslockie@xxxxxxxx>
- Date: Wed, 27 Feb 2008 20:11:43 -0800 (PST)
On Feb 27, 10:31 pm, "John W. Krahn" <some...@xxxxxxxxxxx> wrote:
jammer wrote:
Why does this give a syntax error?
There is no syntax error there.
# not 2 arguments, print usage
if ($#ARGV != 1) {
That's a great way to confuse a newby. Why does the comment say "2
arguments" but you are comparing the variable to 1? Try it like this:
# not 2 arguments, print usage
if ( @ARGV != 2 ) {
print "\nusage: " . $ARGV[0] . "\[backupDir\] \
Unlike C, Python, etc. the first argument of @ARGV is *not* the program
name, you want the $0 variable instead.
I had a missing semi-colon and the error pointed to that block. :-(
.
- Follow-Ups:
- Re: code help
- From: Jim Gibson
- Re: code help
- References:
- code help
- From: jammer
- Re: code help
- From: John W. Krahn
- code help
- Prev by Date: Re: Converting "’" to an Apostrophe?
- Next by Date: FAQ 4.28 How do I change the Nth occurrence of something?
- Previous by thread: Re: code help
- Next by thread: Re: code help
- Index(es):
Relevant Pages
|
|