Hi Rajesh,
On Wed, 16 May 2012 16:11:13 +0530
Rajesh Saha <[email protected]> wrote:
> Hi,
>
> Sorry for one typo. Read "GetOptions" in place of "Getoptions" .
>
> Regards,
> Rajesh
>
>
>
Here is how I do it:
#! /usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
my $dry_run = 0;
GetOptions('version|V' => sub { version(); exit; },
'dry-run|n' => \$dry_run,
'help|h' => sub { usage(); },
) or usage();
exit;
sub version {
print "$0: Version 0.1\n";
exit;
}
sub usage {
print <<"END_USAGE"
Usage: $0 [ Options ]
This script does important work
Options:
-n, --dry-run Simulates rsync commands
-V, --version Print version
-h, --help This help
END_USAGE
;
exit;
return;
}
--
Manfred
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/