Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

(Guildenstern) Re: Getopt Behavior

by Guildenstern (Deacon)
on Dec 05, 2000 at 23:01 UTC ( [id://45057]=note: print w/replies, xml ) Need Help??


in reply to Getopt Behavior

Here's an example from some code that I've written. This will allow the user to specify multiple IP addresses without having to use the command line switch multiple times.
use Getopt::Long; GetOptions("i:s",\@ignored_IPs);

This lets me say "-i 1.1.1.1 2.2.2.2" etc and all of the IPs are stored in the @ignored_IPs array. AFAIK, only Getopt::Long does this.

Update: After taking a better look at your code, it looks like all you really should have to do is make your variable name that will hold the options into a reference.

Guildenstern
Negaterd character class uber alles!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-16 17:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found