$VAR1 = { '' => '', '362520' => 'Fktn and Name: fukutin[Rattus norvegicus]', '375790' => 'AGRN and Name: agrin[Homo sapiens]', '3339' => 'HSPG2 and Name: heparan sulfate proteoglycan 2[Homo sapiens]', '1428' => 'CRYM and Name: crystallin, mu[Homo sapiens]', } #### # #!/usr/bin/perl; use strict; use warnings; my $hashfile = 'dumpparse.txt'; unless ( open(DUMPPARSE, $hashfile) ) { print "Could not open file $hashfile!\n"; exit; } my @hashfile = ; foreach my $line (@hashfile){ if ($line = ~s/ $VAR1/ my %hash /) } # Close the file. close DUMPPARSE; exit;