in reply to Not able to print out hash contents correctly

I would like to place each of these in a hash and increment a count

Your code could be simplified and fit your needs :

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my ( %h, $count ); while (<DATA>) { next unless /^>(\d+)/; $count++; defined $1 and $h{$1} = $count; } print Dumper \%h; __DATA__ >34513 -------------------------------MVAIIFDMDGVLYRG -----N-RAIPGVRELIEF-------LKE-R--------G------ >22476 ------------------------------ALKAVLVDLNGTLHI- --------AVPGAQEALKR--------------------------- >56832 ------MARCERLRGA-----ALRDVLG--RAQGVLFDCDGVLWNG- ----E-RAVPGAPELLER-------LAR------------------- >12543 ---------------------------E--QFDILLLDLDGVVYVG- ----D-RLLPGARRALRR----------------------------G >29078 ---------------------------------AVLFDIDGVLVLS- ----W-RAIPGAAETVRQ-------LTH-R--------G--------


'Ebry haffa hoe hab im tik a bush'. Jamaican proverb