Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: array empty when calling script with getopt::long

by graff (Chancellor)
on Apr 29, 2014 at 01:51 UTC ( #1084240=note: print w/replies, xml ) Need Help??

in reply to array empty when calling script with getopt::long

Would it be too difficult or complicated for you to explain what sort of option processing you are actually hoping to do? Normally, when someone writes a command-line tool that handles optional args, it will print a synopsis whenever the user types a bad arg, or specifically asks for help.

Usually, the programmer includes a "-h" option for displaying the synopsis, or simply lets Getopt::Long throw an error when "-h" or "-?" is used as an option, and makes sure to display the synopsis whenever Getopt::Long throws an error.

What would the synopsis be for your script? Why would you need a subroutine to process your options? What do "$substr1" and "$substr2" contain (where is the code that assigns values to those variables)?

  • Comment on Re: array empty when calling script with getopt::long

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1084240]
[reisinge]: 'push @foo, @bar' is the same as '@foo = (@foo ,@bar)' ?
[shmem]: yes, at least for the result in @foo
[shmem]: but the results of both operations are different.
[shmem]: result := the discarded result (what's leftmost of the statement)
[shmem]: push returns the number of elements in @foo, the assignment returns all the elements in the (renewed) @foo

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-04-27 11:38 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (503 votes). Check out past polls.