Re: ARGV array regarding



On Thu, 2008-07-31 at 18:00 +0530, suresh kumar wrote:
Hi,

This is my part of the script,

if (($#ARGV == 1) && ($ARGV[0] eq "-f")) {
..........
............

if ($ARGV[0] ne "-f" ) {
......................
....................

if i run my script i am seeing this kind of warnings.

Use of uninitialized value in string eq at ./lineCount line 30.
Use of uninitialized value in string ne at ./lineCount line 69.

How can i initialize ARGV array?

can anyone help me in this issue.

If you're looking to handle command-line options, you should use the
standard packages. See `perldoc Getopt::Std` and `perldoc Getopt::Long`.


--
Just my 0.00000002 million dollars worth,
Shawn

"Where there's duct tape, there's hope."

"Perl is the duct tape of the Internet."
Hassan Schroeder, Sun's first webmaster

.



Relevant Pages

  • Re: Logical problem with small script??
    ... script and finding it very useful. ... >> Wrote it to convert a string using a ceaser cipher for a course I am ... > That eliminates the warnings message and makes the code shorter and easier ... > to read but you can do the same thing without the foreach loop and the $count ...
    (perl.beginners)
  • Re: Newbie question re initialization
    ... Use of uninitialized value in concatenation or string at foo.pl line 19. ... Why is $username undef then? ... The script where I receive the above warnings not only works fine, ...
    (comp.lang.perl.misc)
  • Re: Newbie question re initialization
    ... Use of uninitialized value in concatenation or string at foo.pl line 20. ... *will* leave that form element blank. ... The script where I receive the above warnings not only works fine, ... That's why I don't understand the warnings. ...
    (comp.lang.perl.misc)
  • ARGV array regarding
    ... if i run my script i am seeing this kind of warnings. ... Use of uninitialized value in string eq at ./lineCount line 30. ... How can i initialize ARGV array? ...
    (perl.beginners)
  • Re: How to rewrite with awk?
    ... > I'm unfamiliar with tools such as sed & awk. ... Extract the string that matches a RE. ... This script will not only expand all the lines that say "include ... file) and not resetting ARGV(the tmp file), it then lets awk do any ...
    (comp.unix.shell)