#!/usr/bin/perl use warnings; use strict; use Slurp; use Data::Dumper; my $strings = join '|', qw( AB AC AD AE FG ); my $counts; for my $file (glob ('File/*')) { $counts->{$_}++ foreach (Slurp($file) =~ m/($strings)/gms); } print Dumper($counts);
In reply to Re: Reading through a file and checking for a specific string
by BillKSmith
in thread Reading through a file and checking for a specific string
by vihar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |