Perl exapmle while (<>) { foreach my $word (split) { if ($word =~ /ing$/) { print "$word\n"; } } }