@matches = grep { /keyword/ } @file_records; foreach (@matches) { push(@chomped, chomp($_)); }