in reply to GetOpt Organization
Not used this before myself, no idea whether there is an established pattern. Here is my proposal:
use strict; use warnings; use Getopt::Long; my %parms = ( "os|o" =>\(my $showos =0), "rel|r" =>\(my $showrel =0), "arch|a" =>\(my $showarch =0), "iface|i"=>\(my $showiface=0), "hd|h" =>\(my $showhd =0), "mem|m" =>\(my $showmem =0), "user|u" =>\(my $showuser =0), ); GetOptions ( %parms, "all|A" => sub { $$_=1 for values %parms }, "help|h" => sub { &help; exit 0; } ); $showos=5; print "$showos,$showrel,$showarch,$showiface,$showhd,$showmem,$showuse +r\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: GetOpt Organization
by RichardK (Parson) on Mar 09, 2015 at 14:16 UTC | |
by hdb (Monsignor) on Mar 09, 2015 at 14:18 UTC | |
by RichardK (Parson) on Mar 09, 2015 at 14:51 UTC |