- or download this
while (my($name,$n1,$n2)=split(' ',<INFILE>) {
# do something...
}
- or download this
open FILE, "< file2.txt" or die;
my @file2= <FILE>; # read the whole thing
close (FILE);
- or download this
foreach my $hit (grep /^$name\w+/, @file2) {
my($name_2,$n1_2,$n2_2)=split(' ',$hit); # same as you did before.
print "Found $hit\n" if $n1 == $n1_2;
}