in reply to Re: Getopt Behavior
in thread Getopt Behavior

Non-standard? Getopt::Long supports this with no problems. Here's a snippet from the POD:
Example of using variable references: $ret = GetOptions ('foo=s', \$foo, 'bar=i', 'ar=s', \@ar); With command line options ``-foo blech -bar 24 -ar xx -ar yy'' this wi +ll result in: $foo = 'blech' $opt_bar = 24 @ar = ('xx','yy')

Looks to me like Getopt should have no problem with the original question. gaspodethewonderdog just needs to change the variable into a reference.

Update: MeowChow is right - the example does use the -ar multiple times instead of just once. However, I do know that it can be done, since I have a working example.

Guildenstern
Negaterd character class uber alles!

Replies are listed 'Best First'.
Re: (Guildenstern) Re: Re: Getopt Behavior
by MeowChow (Vicar) on Dec 06, 2000 at 01:25 UTC
    In this example, the -ar switch must be specified once for each list element, which is exactly what he wants to avoid. He's looking for a syntax which will understand: -foo blech -bar 24 -ar xx yy