1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#! perl -w use strict; use warnings; use Getopt::Long; my ( $quiet, $test, $alltype1, $debug, $destdir, $logfile, $help, $version ); GetOptions( 'debug|verbose|v|d' => \$debug, 'test|t' => \$test, 'all|a' => \$alltype1, 'quiet|q' => \$quiet, 'destination|outputdir|o=s' => \$destdir, 'log|l' => \$logfile, 'help|h|?' => \$help, 'Version|V' => \$version );
-v test
1 2 3 4 5 6 7 8 9
if ( exists $opctl->{$_} ) { $dups .= "Duplicate specification \"$opt\" for option \"$_\"\n"; } ... if ( $dups && $^W ) { foreach ( split(/\n+/, $dups) ) { warn($_."\n"); } }