Re: Perl Syntax

From: Steve Bertrand (steveb_at_eagle.ca)
Date: 06/30/04

  • Next message: Cordula's Web: "Re: Snapshot question"
    Date: Wed, 30 Jun 2004 13:04:45 -0400 (EDT)
    To: "Drew Tomlinson" <drew@mykitchentable.net>
    
    

    > 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"
    >

    _______________________________________________
    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"


  • Next message: Cordula's Web: "Re: Snapshot question"

    Relevant Pages

    • Unsubscribe
      ... To subscribe or unsubscribe via the World ... Ubuntu magic ... Re: Locale settings (SYNass IT ... Subject: shorten "exit"!? ...
      (Ubuntu)
    • Re: debootstrap chroot problem
      ... When I issue the following command ... > exit. ... > As you may have noticed, I created the '/chroot/' mount point for this ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
      (Debian-User)
    • Re: ignore additional launches
      ... They'll repeatedly press the mouse, perhaps thirty times, ... Change the icon to run a wrapper shell script which checks ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
      (Debian-User)
    • Re: bash/echo/sed/date question (?)
      ... executes a command and returns the command's exit status, ... The error message is written to standard error. ... In the working version I have used the plain "date" command, ...
      (comp.unix.shell)
    • Re: Perl Syntax
      ... >>to check for value passed from command line. ... >>exit with an error message. ... Use of uninitialized value in string eq at ./test.pl line 16. ...
      (freebsd-questions)