Re: Perl Syntax
From: Matthew Seaman (m.seaman_at_infracaninophile.co.uk)
Date: 06/30/04
- Previous message: Charles Swiger: "Re: Using syslog(3) after chroot-ing"
- In reply to: Drew Tomlinson: "Re: Perl Syntax"
- Next in thread: Drew Tomlinson: "Re: Perl Syntax -- SOLVED"
- Reply: Drew Tomlinson: "Re: Perl Syntax -- SOLVED"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Jun 2004 18:34:59 +0100 To: Drew Tomlinson <drew@mykitchentable.net>
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;
}
--
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
- application/pgp-signature attachment: stored
- Previous message: Charles Swiger: "Re: Using syslog(3) after chroot-ing"
- In reply to: Drew Tomlinson: "Re: Perl Syntax"
- Next in thread: Drew Tomlinson: "Re: Perl Syntax -- SOLVED"
- Reply: Drew Tomlinson: "Re: Perl Syntax -- SOLVED"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|