User Tools

Site Tools


perl:command_line_options_and_usage_with_getopts
#!/usr/bin/perl
 
use Getopt::Std;
 
my %opt;
getopts( 'afqcrh', \%opt ) or usage();
usage() if ($opt{h} or !@ARGV);
 
sub usage() {
	(my $progName = $0) =~ s#.*[/\\]##;
	print <<EODOC;
TITLE
 
INFO
 
Usage:
    $progName [-a | -f | -q] [-r] [-c] [-h] [files]
 
Options:
  -a Stuff
  -f Stuff
  -q Stuff
 
EODOC
	exit;
}
perl/command_line_options_and_usage_with_getopts.txt · Last modified: 2009/08/13 09:57 by tkbletsc