my %hash; open PFAMDB, "C:\\Users\\Jems\\Desktop\\Perl\\Pfam-A.seed" or die $!; #thats the main file. while (my $pfam=){ my @units= split /#/,$pfam; if ($pfam=~ =GF AC){my $pf=$pfam;} if ($pfam=~ \sAC\s){if exists $hash{$pfam}{$hash{$pfam}=$pf} else .....