From owner-freebsd-questions@FreeBSD.ORG  Wed Jun 30 16:51:22 2004
Return-Path: <owner-freebsd-questions@FreeBSD.ORG>
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 BEC4F16A4CE
	for <freebsd-questions@freebsd.org>;
	Wed, 30 Jun 2004 16:51:22 +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 DF4C443D4C
	for <freebsd-questions@freebsd.org>;
	Wed, 30 Jun 2004 16:51:21 +0000 (GMT)
	(envelope-from drew@mykitchentable.net)
Received: (qmail 10547 invoked from network); 30 Jun 2004 16:51:09 -0000
Received: from 67-51-112-35.dsl1.elk.ca.frontiernet.net (HELO
	blacklamb.mykitchentable.net) ([67.51.112.35])
	(envelope-sender <drew@mykitchentable.net>)SMTP
	for <freebsd-questions@freebsd.org>; 30 Jun 2004 16:51:09 -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 A9D393BF422
	for <freebsd-questions@freebsd.org>;
	Wed, 30 Jun 2004 09:51:08 -0700 (PDT)
Message-ID: <40E2EF7E.3000901@mykitchentable.net>
Date: Wed, 30 Jun 2004 09:51:10 -0700
From: Drew Tomlinson <drew@mykitchentable.net>
User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: FreeBSD Questions <freebsd-questions@freebsd.org>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Perl Syntax
X-BeenThere: freebsd-questions@freebsd.org
X-Mailman-Version: 2.1.1
Precedence: list
List-Id: User questions <freebsd-questions.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>,
	<mailto:freebsd-questions-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-questions>
List-Post: <mailto:freebsd-questions@freebsd.org>
List-Help: <mailto:freebsd-questions-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-questions>,
	<mailto:freebsd-questions-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 30 Jun 2004 16:51:22 -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?

Thanks,

Drew

-- 
Visit The Alchemist's Warehouse
Magic Tricks, DVDs, Videos, Books, & More!

http://www.alchemistswarehouse.com