On Fri, 17 Jun 2005 10:57:26 +0200 Johan Vromans <[EMAIL PROTECTED]> wrote: > Eric Wilhelm <[EMAIL PROTECTED]> writes: > > Please see this essay > > http://scratchcomputing.com/svn/Getopt-Modern/trunk/data/notes/why_order_matters.txt > If your spouse tells you to get "tuna and halibut, but not any > other fish", you would probably get in trouble if you returned > from the store with no fish, and yet this is what programmers seem > to expect from the following command-line: > > go_shop --fish tuna --fish halibut --no-fish > > But the results should be the same as below: > > go_shop --no-fish --fish tuna --fish halibut
To Eric, I did not notice the go_shop problem. But I think it's trivial to solve that with Getopt::Long: my @conf_fishes = read_conf("fish"); # get qw(trout) my @opt_fishes = qw(); my $opt_nofish = 0; Getopt::Long::GetOptions( "fish=s" => [EMAIL PROTECTED], "no-fish" => \$opt_nofish, ); @conf_fishes = qw() if $opt_nofish; my @fishes = (@conf_fishes, @opt_fishes); Who said the variable to save the "no-fish" status has to be revelant with the "fish" variable anyway? If they are saved in different variables, the order doesn't matter, does it? -- Best regards, imacat ^_*' <[EMAIL PROTECTED]> PGP Key: http://www.imacat.idv.tw/me/pgpkey.txt <<Woman's Voice>> News: http://www.wov.idv.tw/ Tavern IMACAT's: http://www.imacat.idv.tw/ TLUG List Manager: http://www.linux.org.tw/mailman/listinfo/tlug
pgpf9fwozK3Jp.pgp
Description: PGP signature