my $left_text = [ qw{ when rome romans} ];
my $right_text = 'When in Rome, Romans do as the Romans do in Rome.';
####
#!/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
####
my $left_text = [ qw{ when rome romans} ];
my $right_text = 'When in the Terrordrome, do as the Romans.';
####
#!/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