in reply to regex matching using arrays

I'm assuming you're trying to get a list of which words are present in the text. substr is faster than regex for this, and lowercase searching is faster than case insensitive, so:
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"; $foo = lc($foo); my @f; for (@bah) { push @f, $_ if index($foo, lc($_)) != -1; } print join(' ', sort @f), "\n";
I really don't think you're going to be able to get out of looping somewhere in the code, though.