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

Re: multiple entries per option (Getopt)

by Perlbotics (Abbot)
on Jan 26, 2012 at 20:51 UTC ( #950218=note: print w/ replies, xml ) Need Help??


in reply to multiple entries per option (Getopt)

You could feed your examples to the following program and see what happens... The important part is the "o=s" telling Getopt to look for -o switches with a string argument and the array-ref telling it to accumulate the -o arguments into an array.

use strict; use warnings; use Getopt::Long; my @o_list; unless ( GetOptions ("o=s" => \@o_list) ) { print "GetOptions had problems parsing ARGV!\n"; } print "List of -o things: ", join(", ", @o_list), "\n"; print "Unparsed arguments: ", join(", ", @ARGV ), "\n";


Comment on Re: multiple entries per option (Getopt)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-08-28 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (255 votes), past polls