From owner-freebsd-questions@FreeBSD.ORG Wed Jun 30 17:04:37 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 4FA0A16A4CE for ; Wed, 30 Jun 2004 17:04:37 +0000 (GMT) Received: from mbox.ibctech.ca (dev.eagle.ca [209.167.58.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F45B43D45 for ; Wed, 30 Jun 2004 17:04:36 +0000 (GMT) (envelope-from steveb@eagle.ca) Received: (qmail 96330 invoked by uid 1002); 30 Jun 2004 17:04:47 -0000 Received: from steveb@eagle.ca by pearl.ibctech.ca by uid 89 with qmail-scanner-1.22 (clamscan: 0.73. spamassassin: 2.63. Clear:RC:1(127.0.0.1):. Processed in 1.010374 secs); 30 Jun 2004 17:04:47 -0000 Received: from unknown (HELO pearl.ibctech.ca) (127.0.0.1) by localhost.ibctech.ca with SMTP; 30 Jun 2004 17:04:45 -0000 Received: from 209.167.16.15 (SquirrelMail authenticated user steve@ibctech.ca); by pearl.ibctech.ca with HTTP; Wed, 30 Jun 2004 13:04:45 -0400 (EDT) Message-ID: <4769.209.167.16.15.1088615085.squirrel@209.167.16.15> In-Reply-To: <40E2EF7E.3000901@mykitchentable.net> References: <40E2EF7E.3000901@mykitchentable.net> Date: Wed, 30 Jun 2004 13:04:45 -0400 (EDT) From: "Steve Bertrand" To: "Drew Tomlinson" User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal cc: FreeBSD Questions Subject: Re: Perl Syntax 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:04:37 -0000 > I'm using perl 5.8.4 on a 4.9 machine. I want to add code a perl script > to check for value passed from command line. If it is null, I want to > exit with an error message. > > First I tried this and got "Use of uninitialized value in string eq at > ./test.pl line 20." > > if ($ARGV[0] eq "") { > print "You must include the file name."; > exit 1; > } > > Next I tried this but get "Use of uninitialized value in length at > ./test.pl line 20." > > if (length ($ARGV[0]) = "0") { > print "You must include the file name."; > exit 1; > } > > I've searched the web and all examples that I've found indicate that I'm > doing things correctly but obviously I'm not. What am I doing wrong? > I know this works: if ($ARGV[0] eq '') { print "Debug Mode\n"; } Cheers, Steve > Thanks, > > Drew > > -- > Visit The Alchemist's Warehouse > Magic Tricks, DVDs, Videos, Books, & More! > > http://www.alchemistswarehouse.com > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org" >