Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: multiple entries per option (Getopt)

by Perlbotics (Chancellor)
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";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950218]
[LanX]: sorry, i didn't break math yet, but it's top priority on my todo list
[choroba]: does your list start with number 5?
[LanX]: -i
LanX it's an imaginary list ...
LanX ... reflecting root problems
choroba uses real lists so he can easily insert as many items in between as needed
LanX questions the integerity of this approach. ..

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (13)
As of 2018-03-20 10:24 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (249 votes). Check out past polls.