on-internet
← Community

Getopts perl order

Stack Overflow ·

I am having some problems with getopts in Perl. I use: getopts("abc:ds:", \%options); and I'm checking the options with if (defined $options{a}) where $options is the hash the options are written into. After the options, the user has to enter a file name, that I locate with $ARGV[0]. The problem is that the user can not put the options after the file name, but only before. So this is working: skript.pl -a file.txt And this is not working: skript.pl file.txt -a How can I fix this problem?

Comments

Sign in or sign up to comment and upvote.

No comments yet.