Curtis, Jonathan wrote:

> sub have_we_met{  
> open DATA, "bigdawgs.txt";
> @data = <DATA>;
> close DATA;
> $
> $found = 0;
>  
>         for ($i = 0; $i <= $#data; $i++){
>                 @cheese = split /,/, $data[$i];
>                 if ($cheese[0] eq $ntlogin) {
>                         $found=1;
>                         $eindex=$i;
> }
> }
>  
> }

> 
> ---
> The line in bold "if ($cheese[0] eq $ntlogin) {" causes error "Use of
> uninitialized value..." for each repetition of the loop.
>  
> I know $ntlogin is initialized cause it's used all over the place...
> I know @cheese is getting info, because I can print it's contents.


is it really initialized?  a good way to find out is to use data::dumper:

use Data::Dumper;
print "ntlogin: ", Dumper($ntlogin);

and if you see something like this echo to the screen:

ntlogin: $VAR1 = undef

then there's your problem.

a side note:  read your text file like this:

open DATA, "bigdawgs.txt";

while (<DATA>) {

   # do something.....

}

close DATA;

if you do it this way, you won't need $eindex or $i.  the current line 
will be available in the special variable $. (that's string-dot - the 
dot here is not the end of the sentence).  also, it will consume less 
memory.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to