limzz has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, so I need to implement a script that somebody else wrote, but I can't figure out what they're doing with getopts.pl. Here's what's confusing me:
&Getopts('afg:s:n:vb:cd');
What does this mean? I tried to read about it and found something about ':' separating options that expect arguments or not, but the info I found wasn't very detailed. I can tell from the code which variables are which, but I would like to understand this line, and if it affects how I should call the script. Thanks in advance :)
EDIT: Okay, so I read Getopt::Std as suggested. I didn't realize the colon applied only to the letter before it, I thought they separated groups or something weird... This makes sense, however in the script they are assigning a variable to $opt_f, but isn't that option supposed to be a Boolean?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: getopts help
by jethro (Monsignor) on Aug 11, 2011 at 15:04 UTC | |
|
Re: getopts help
by Perlbotics (Archbishop) on Aug 11, 2011 at 15:10 UTC | |
|
Re: getopts help
by TomDLux (Vicar) on Aug 11, 2011 at 15:10 UTC | |
|
Re: getopts help
by toolic (Bishop) on Aug 11, 2011 at 15:25 UTC |