#!/usr/bin/env perl use strict; use warnings; use Test::More; my @hant = ('Gloin1'); my @counts = (2); plan tests => scalar @hant; my $nrt2 = <Gloin1_46659 MVKLFARPLPIDP.... >Gloin1_30454 MIKLFDKPSKELS.... EOT for my $pat (@hant) { my $matches = () = $nrt2 =~ /$pat/g; is ($matches, shift @counts, "Correct number of matches found for $pat"); }