in reply to Test for parameters?

You probably mean @ARGV instead.

Checking the index of the last element of the array is rarely the best option, too. In scalar context, the array gives you the number of elements -- that works very well in the boolean context used here:

die "Exiting without parameter.\n" unless @ARGV;

Replies are listed 'Best First'.
Re: Re: Test for parameters?
by Guildencrantz (Sexton) on Mar 27, 2003 at 08:04 UTC

    ARG!!!!!!!

    It is absolutely insane how freaking stupid things get. Yes, @ARGV. @_ is when passing parameters to FUNCTIONS, not into the script itself. See, I know this.

    I think I need sleep.

    Thank you so much.

    Maybe I just need caffein?

    Anyway, I really appreciate that. Every now and then I just need somebody to take a 2x4 and smack me back into reality.

    ~~Guildencrantz

      Guildencrantz said:

      ARG!!!!!!!

      Silly, silly, silly.... it's not @ARG, is @ARGV :P

      ( Sorry folks, I just had to throw that in! )


      If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.