Saber numero de ocurrencias en archivo y lista
AUTOR PREGUNTA #1
-
¿Tienes la misma pregunta? Yo también
Esto también te interesa!
PREGUNTAS SIMILARES
#2
use strict;
use warnings;
my @regexes = ( qr/b/, qr/a/, qr/foo/, qr/quux/, );
my %matches = map { $_ => 0 } @regexes;
while (my $line = <DATA>) {
for my $regex (@regexes) {
next unless $line =~ /$regex/; $matches{$regex}++; } }
for my $regex (@regexes) {
print "$regex matched $matches{$regex} times\n"; } __DATA__ foo bar baz