Hi, Sorry for one typo. Read "GetOptions" in place of "Getoptions" .
Regards, Rajesh On Wed, May 16, 2012 at 2:39 PM, Rajesh Saha <rajeshsaha...@gmail.com>wrote: > Hi, > > In my program, I am using the module Getopt::Long > > My intension is that if the user chooses "--help", the program should show > the help message without bothering whether other options has been used or > not. > > My program (say, test.pl) : > > use Getopt::Long > my $abc; > my $help; > > Getoptions ( "abc=s" => \$abc, > "help" => \$help > ); > > if ($help) { print "This is help message\n" ; exit ;} > > if ($abc) { print "You have choosen \"abc\" as $abc" }; > > > If I run this: > > 1. test.pl -help > Output: This is help message > > 2. test.pl -abc ABC > Output : You have choosen abc as ABC > > 3. test.pl -abc -help > Output: You have choosen abc as -help > > Out the above results 1 & 2 are fine, but 3 is not as I want. I understand > what's happening here [$abc is assigned as "-help"], but don't have idea > how to implement it properly so that in the 3rd it would print like " This > is help message" . > > Can anybody help please ? > > > Thanks n regards > Rajesh Saha > >