[Chicago-talk] alternatives to Getopt::Long

Steven Lembark lembark at wrkhors.com
Sun May 9 00:55:58 CDT 2004



-- Jim Thomason <jthomasoniii at yahoo.com>

>>    --foo a b c --bar 1 2 3
>
> You could always roll your own.
>
> Look, here's a fancy (and inefficient) oneliner to
> stick 'em into a hash:
>
> my %args = map {/--\w+/ ? $_ : [grep {/\S/} split /
> /]} grep {length} split(/(--\w+)/, join(' ', @ARGV));

How would you want to handle mixed types or cases where
a lone '-' ends the switches (e.g., grep)?

-- 
Steven Lembark                           9 Music Square South, Box 344
Workhorse Computing                                Nashville, TN 37203
lembark at wrkors.com                                      1 888 359 3508



More information about the Chicago-talk mailing list