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