Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Command Line Arguments

by ZZamboni (Curate)
on Jul 07, 2000 at 06:35 UTC ( #21394=note: print w/replies, xml ) Need Help??


in reply to Command Line Arguments

Getopt::Long can have single-letter aliases for the long arguments. You separate the aliases with "|" in the argument specification. So for example if you say:
GetOptions('copies|n=i' => \$copies);
You will be able to use all of:
-n 5 --copies=5 --copies 5
as arguments.

--ZZamboni

Replies are listed 'Best First'.
RE: Re: Command Line Arguments
by Adam (Vicar) on Jul 07, 2000 at 08:11 UTC
    Thats cool. I didn't see that in the documentation. Sigh. I already wrote my own function to parse the command line aliasing the commands with single chars and allowing the grouping of single chars so you can say -bc instead of -b -c. That was this afternoon while PM was down. Now I don't know if I want to go back and replace that with Getopt::Long... We'll see. Plus my parser recognizes '/' as an alternative parameter lead in addition to '-'... sigh.

    Thanks ZZamboni

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-11-30 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?