use Getopt::Long; my $name; my $age; my $option=GetOptions("name"=>\$name,"age"=>\$age); print "the options are $option\n"; if ("$name") { print "the option given is divakar\n"; } if ("$age") { print "the option given is 24"; } #### the options are 1 Use of uninitialized value $name in string at C:/Diva Projects/Eclipse/Scripts_Testing/getopt.pl line 8. Use of uninitialized value $age in string at C:/Diva Projects/Eclipse/Scripts_Testing/getopt.pl line 13.