我有以下手稿:
my $directory; my @files; my $help; my $man; my $verbose; undef $directory; undef @files; undef $help; undef $man; undef $verbose; GetOptions( "dir=s" => $directory, # optional variable with default value (false) "files=s" => @files, # optional variable that allows comma-separated # list of file names as well as multiple # occurrenceces of this option. "help|?" => $help, # optional variable with default value (false) "man" => $man, # optional variable with default value (false) "verbose" => $verbose # optional variable with default value (false) ); if (@files) { @files = split(/,/,join( , , @files)); }
处理相互排斥的指挥线论点的最佳方式是什么? 我只想让用户只进入“-dir”或“-files”的指挥线论点,而不是两者。 难道有什么办法可以让Getopt这样做?
感谢。