in reply to searching something IN a regex ?

Not to be dismissive, but please read How do I post a question effectively?. It would assist us terribly if you provided both some sample text that one would find in a PDB file as well as the code you've written that counts your lines.

Barring additional information, you're probably best off using a hash to index captured values. Something like:

use strict; use warnings; my %matches = (); while (<DATA>) { if (/Good\s(\d)/) { $matches{$1}++; } } foreach my $key (keys %matches) { print "$key: $matches{$key}\n"; } __DATA__ Good 1 Good 2 Good 3 Bad 1 Bad 2 Bad 1 Good 3 Good 1