I know there is probably a silly error causing this, but I'm new to Perl and
this is driving me crazy..
 
This subroutine takes the user's login name ($ntlogin) and searches the flat
file for matching entry.
 
The flatfile contains user info, comma delimited... each user separated by
line.  The flatfile is read by line into @data, then splits each field of
@data by comma into @cheese as it searches for the correct login name
 
so values in cheese would look like
$cheese[0] = jcurtis
$cheese[1] = Jonathan Curtis
$cheese[2] =  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
....
 
The loop should return a flag ($found =1) and the line number ($eindex) of
the user's data...
--
 
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.
 
Any ideas?

Thanks,

Jon
 

 

Reply via email to