on-internet
← Community

Issues with getopts in perl

Stack Overflow ·

I'm using Getopt::Std to process my command line args. My command line args are strings. I have an issue with getopts(), as it works only for single character based opts. As seen below "srcdir" "targetdir" options are mandatory and script should error out if any one of them is missing. "block" is NOT a mandatory option. I don't see %options has is being set with the code below, and all my options{key} are NULL. Had I replaced "srcdir=>s" and "targetdir=>t" then the below piece of code works. It doesn't work with "-srcdir" "-targetdir" options. What's the best way to address the issue I have? U

Comments

Sign in or sign up to comment and upvote.

No comments yet.