if(@ARGV="h")
A single equals sign is an assignment operator. You're overwriting the value of @ARGV with "h". As "h" is true, that expression will always be true.
You need two equals signs to check equality. But that checks _numeric_ equality, so you actually need "eq"
if(@ARGV eq "h")
But that's still not right as that compares "h" to the number of elements in @ARGV. If the "h" will always be the first option on the command line, then you could do this:
if ($ARGV[0] eq 'h')
Or to cover more options, you could use this:
if (grep { $_ eq 'h' } @ARGV)
But really, you should look at one of the command line option processing modules like Getopt::Std or Getopt::Long.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Help display when executing the script
by davorg
in thread Help display when executing the script
by rsriram
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |