#!/usr/bin/perl use strict; use warnings; my @left_text = qw{ when rome romans}; my $right_text = 'When in the Terrordrome, do as the Romans.'; my $count = '0'; for my $search_text (@left_text) { if ($right_text =~ /\b\Q$search_text\E\b/i) { $count++ } } print "Found = $count\n"; __END__ Found = 2