Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2020-02-25 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (110 votes). Check out past polls.

    Notices?