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

Re^2: getopts and -?

by viffer (Beadle)
on May 10, 2011 at 02:35 UTC ( #903892=note: print w/replies, xml ) Need Help??

in reply to Re: getopts and -?
in thread getopts and -?

Thanks for both your help.

I have now got it working aside of one issue.

our ( $opt_d,$opt_h,$opt_l,$opt_L,$opt_i,$opt_o,$opt_P,$opt_p,$opt_q,$ +opt_r,$opt_v,$opt_c,$opt_z ); # 'L' =>\$opt_L, # 'p' =>\$opt_p, GetOptions ( 'd' =>\$opt_d, 'h' =>\$opt_h, 'l' =>\$opt_l, 'i' =>\$opt_i, 'o:s' =>\$opt_o, 'P:s' =>\$opt_P, 'q' =>\$opt_q, 'r' =>\$opt_r, 'v:s' =>\$opt_v, 'c' =>\$opt_c, 'help|?!' =>\$opt_z, );
If I include both upper and lower case options L and P I end up getting the error message
'Duplicate specification "L" for option "l"'

Is there a way to parse both upper and lower case characters for the same letter?

Appreciate your time and help.

Replies are listed 'Best First'.
Re^3: getopts and -?
by Anonymous Monk on May 10, 2011 at 02:52 UTC
      Thank you, I should learn in future to take more time before i ask a question. You were typing a response at the same time as i was asking the question! :)
Re^3: getopts and -?
by viffer (Beadle) on May 10, 2011 at 02:43 UTC
    Oops..posted my version prior to reading your responses (honest i had got there off my own accord!) but like your versions, you both have "L & l" and "P & p" which getoptions doesn't seem to like, thinking they are duplicates.
      Case and abbreviations

      Without additional configuration, GetOptions() will ignore the case of option names, and allow the options to be abbreviated to uniqueness.

      Just wondering if anyone knows what "additional configuration" is required?

        use Getopt::Long qw(:config no_ignore_case);

        I'll get my coat!

        Thanks for your help :)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-05-23 11:29 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (81 votes). Check out past polls.