in reply to Constructing a hash

Yeah, like the other people said, your code has some serious fundamental problems... May need to hit an intro to perl tutorial or something... But, for now:
use strict; use warnings; use Data::Dumper; open (FH, "<data.txt"); my (%hash); while (my $line = <FH>) { my $key = lc($line); $hash{$key} = $line; } close(FH); open (FH, ">hash.txt"); print FH Data::Dumper->Dump([%hash]); close(FH);
That should work for you.