Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Well, one problem is that you are first calling GetOptions, and then asking that @ARGV not be empty... however, the way that GetOptions works is to remove values from @ARGV. So if all that is contained in @ARGV are -options, then after GetOptions, they'll have all been removed from @ARGV, and @ARGV will be empty.
Another problem (that isn't with your Getopt::Long), is with your shell scripting. If you want to pass all arguments through to a command in a shell script, it's done like: rather than The difference can be demonstrated if you just take this simple shell script (lets call it "test.sh"): and call it with some arguments that will demonstrate why this breaks: but if we change test.sh to: and run it the same way: The difference being that "$@" will preserve the arg list as a list, whereas $* will flatten it all into a string (basically just like join(" ",@ARGV)), and then split it on whitespace... so if you had args with whitespace in them it would get all messed up. At the very least, that's a couple of things that might be causing you problems.
In reply to Re: problem with Getopt::Long
by etcshadow
|
|