Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: GetOpt::Long usage style (\my @a)

by tye (Sage)
on May 09, 2014 at 00:37 UTC ( #1085521=note: print w/replies, xml ) Need Help??


in reply to Re^3: GetOpt::Long usage style
in thread GetOpt::Long usage style

use Getopt::Long; GetOptions( 'single=s' => \(my $single = ''), 'multi=s' => \my @multi, );

If you want to provide a non-empty default value, one way is:

use Getopt::Long; GetOptions( 'single=s' => \(my $single = ''), 'multi=s' => grep { @$_ = ('a','b') } \my @multi, );

- tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (12)
As of 2019-05-23 18:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (146 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!