suresh kumar wrote: > > 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.
The @ARGV array holds the whitespace-split contents of the command line used to start perl. If you run a program with perl myprog.pl a b c then @ARGV will contain ('a', 'b', 'c'). It doesn't normally need initialising, but you can assign to it if you want to simulate a command line. $#ARGV is the highest valid index of @ARGV, so $#ARGV == 1 is testing whether @ARGV has two elements (at indices 0 and 1). The second test $ARGV[0] eq "-f" will be performed only if the first succeeds, and since you've established that there are two elements the first can only be undefined if you've explicitly made it so, with delete $ARGV[0]; or something similar. I can't really tell what the problem might be without seeing your full code. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/