Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: $ARGV dilemma

by dusk (Friar)
on May 27, 2001 at 06:11 UTC ( [id://83562]=note: print w/replies, xml ) Need Help??


in reply to $ARGV dilemma

UPDATE: Err, I answered my own question right after submission; I apologize for asking such a silly question, and jumping to ask, before giving it any thought.
The solution is, of course, to just use unless $ARGV[2].

UPDATE 2: I guess I should have been more precise in both my question and update. Originally, the last argument was 0; but changing it to a string was the solution I came up with..

Replies are listed 'Best First'.
Re: Re: $ARGV dilemma
by dws (Chancellor) on May 27, 2001 at 07:42 UTC
      unless $ARGV[2] works until someone passes a zero. You could amend it to   unless defined $ARGV[2] though   if 3 > @ARGV reads better, at least in my opinion.

Re: Re: $ARGV dilemma
by wog (Curate) on May 27, 2001 at 07:41 UTC
    That won't always work.

    What if @ARGV = ("0","0","0"). Then $ARGV[2] is false and you get an error despite having three arguments.

    You probably like something like unless @ARGV == 3.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://83562]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 16:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found