From owner-freebsd-questions@FreeBSD.ORG Wed Jun 30 17:51:17 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2573916A4CF for ; Wed, 30 Jun 2004 17:51:17 +0000 (GMT) Received: from relay03.roc.ny.frontiernet.net (relay03.roc.ny.frontiernet.net [66.133.131.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE60E43D2D for ; Wed, 30 Jun 2004 17:51:16 +0000 (GMT) (envelope-from drew@mykitchentable.net) Received: (qmail 13105 invoked from network); 30 Jun 2004 17:51:03 -0000 Received: from 67-51-112-35.dsl1.elk.ca.frontiernet.net (HELO blacklamb.mykitchentable.net) ([67.51.112.35]) (envelope-sender )SMTP for ; 30 Jun 2004 17:51:03 -0000 Received: from [165.107.42.177] (unknown [165.107.42.177]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by blacklamb.mykitchentable.net (Postfix) with ESMTP id 846813BF422; Wed, 30 Jun 2004 10:51:02 -0700 (PDT) Message-ID: <40E2FD88.9030605@mykitchentable.net> Date: Wed, 30 Jun 2004 10:51:04 -0700 From: Drew Tomlinson User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Matthew Seaman References: <40E2EF7E.3000901@mykitchentable.net> <4769.209.167.16.15.1088615085.squirrel@209.167.16.15> <40E2F5B9.305@mykitchentable.net> <20040630173459.GA7674@happy-idiot-talk.infracaninophile.co.uk> In-Reply-To: <20040630173459.GA7674@happy-idiot-talk.infracaninophile.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: FreeBSD Questions cc: Steve Bertrand Subject: Re: Perl Syntax -- SOLVED X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jun 2004 17:51:17 -0000 On 6/30/2004 10:34 AM Matthew Seaman wrote: >On Wed, Jun 30, 2004 at 10:17:45AM -0700, Drew Tomlinson wrote: > > >>On 6/30/2004 10:04 AM Steve Bertrand wrote: >> >> > > > >>>I know this works: >>> >>>if ($ARGV[0] eq '') { >>> print "Debug Mode\n"; >>>} >>> >>> > > > >>Thanks for your reply. I tried your suggestion and it seems to work but >>I get this output: >> >>Use of uninitialized value in string eq at ./test.pl line 16. >>You must include the file name. >> >> > >Unless you supply at least one argument to the script, $ARGV[0] won't >exist. There's a difference in perl between 'not defined' and an >empty string (or zero for numerical values). Try: > > if ( @ARGV < 1 ) { > usage(); > exit 1; > } > >or > > unless ( defined $ARGV[0] ) { > usage(); > exit 1; > } > > Thank you very much for the explanation. Now I understand why I was getting the error message. I didn't quite understand how to use "usage();" but replaced it with a print statement. It works perfectly! Thanks, Drew -- Visit The Alchemist's Warehouse Magic Tricks, DVDs, Videos, Books, & More! http://www.alchemistswarehouse.com