Getopt::Std + Pod::Usage
#!/usr/bin/perl -w
use strict;
use Getopt::Std;
use Pod::Usage;
my(%opt);
getopts('csf:?', \%opt)
or pod2usage(-exitstatus => 1, -verbose => 0);
pod2usage(-exitstatus => 0, -verbose => 2) if($opt{'?'});
sanitise_files(\%opt, @ARGV);
exit 0;
__END__
=head1 NAME
sanitise - clean up files by removing microbes
=head1 SYNOPSIS
sanitise [options] <files>
Options:
-c clean files
-s shine files
-f x select fragrance (x = pine, meadow or toast)
-? detailed help message
=head1 DESCRIPTION
This imaginary script strikes with the power of liquid
lightning to sanitise your files by removing unwanted
microbes. Use strictly as directed. Conditions apply.
=head1 OPTIONS
=over 4
=item B<-c>
Enable the cleaning mode.
=item B<-s>
Enable the shining mode. (Note these options can be
combined for the ultimate clean and shine).
=item B<-?>
Display this documentation.
=back
=head1 COPYRIGHT
Copyright 2005 Grant McLean E<lt>grantm@cpan.orgE<gt>
This library is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
=cut
$ ./02_getopt_usage.pl -p
Unknown option: p
Usage:
sanitise [options] <files>
Options:
-c clean files
-s shine files
-f x select fragrance (x = pine, meadow or toast)
-? detailed help message