Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jun 2004 18:34:59 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Drew Tomlinson <drew@mykitchentable.net>
Cc:        Steve Bertrand <steveb@eagle.ca>
Subject:   Re: Perl Syntax
Message-ID:  <20040630173459.GA7674@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <40E2F5B9.305@mykitchentable.net>
References:  <40E2EF7E.3000901@mykitchentable.net> <4769.209.167.16.15.1088615085.squirrel@209.167.16.15> <40E2F5B9.305@mykitchentable.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--EeQfGwPcQSOJBaQU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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=
=20
> I get this output:
>=20
> 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;
    }



--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

--EeQfGwPcQSOJBaQU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFA4vnDiD657aJF7eIRArvaAKCRs5J9QC5jx2FOBo0x8C8G5ixs2gCfZSDz
zqo98419KZd2SFzmLDeCiDo=
=vWtS
-----END PGP SIGNATURE-----

--EeQfGwPcQSOJBaQU--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040630173459.GA7674>