I've started using Getopt::Long for a little script I'm creating. I'm having trouble figuring out how to give an option a default value if it is specified. For example:
shell$ progname
$opt == 0
shell$ progname --opt
$opt == 100
shell$ progname --opt 7
$opt == 7
Or more verbosely, if --opt isn't specified, I want it to be 0. If --opt is specified, but not given any number, I want $opt to hold 100, and if --opt is specified with a number, I want $opt to hold the number specified.
This is probably really easy, but I must be missing it. Has anybody done this before?
-Bryan