in reply to while statement only picks up first line
my %partners; $partners{$_} = undef for ( @partners ); # make a hash from your exist +ing array # (or preferably, just load your input directly into the hash, setting + the # hash keys to be the strings to look for, and the values as "undef") sub found { open( FH, $data ) or die "Can't open $data: $!"; flock( FH, 1 ) or die "Can't lock $data for reading: $!"; while (<FH>) { my ( $user, $sur, $first, $second ) = split( /\t/ ); print "$first $second $sur" if ( exists( $partners{$user} ); } }
|
|---|