my @terms = qw(Name Age Gender); my $match = "Person2" while (<$file>) { chomp; if (/$match/){ @array= split(/,/); #What next??? } }