use strict; use warnings; open (MER, "Extracted.c") or die "Can't open input file. $!\n"; my %cases; for my $mer(){ my $control; while ($control!=15){ $mer =~ s/ //; $control++; } $cases{$mer}++; } foreach $key ( keys %cases ) { print $key, "\n"; }