#!/usr/bin/perl use strict; use warnings; my @bah = ( "Australia", "Austria", "Finland", "Norway" ); my $foo = "In Australia the people from Austria drink beer at the pub with the people from Norway"; my $result = ""; foreach my $match (@bah) { if ($foo =~ /\Q$match\E/ig) { $result .= $match . " "; } # end-if } # end-foreach print $result, "\n"; exit; # Result = Australia Austria Norway