in reply to Determining which pattern matched

As an alternative to the above, you could do something like...

my @patterns = ("field", "f.i.e.l.d", "the"); my $str = "There are many soccer fields in England - f1i2e3l4d f1i2e3l +4d"; my %matches = map { $_ => [ $str =~ /$_/g ] } @patterns; __END__ { "f.i.e.l.d" => ["f1i2e3l4d", "f1i2e3l4d"], field => ["field"], the => [], }

Unless I state otherwise, all my code runs with strict and warnings