foreach my $word (@words) { print "$word\n" if ($word =~ /home/); }