open (INFILE, "datafile.txt") or die "oopsie can not open datafile.txt! $1\n"; while () { chomp; ($part1,$part2) = split /=/; $itsahash{"$part1"} = $part2; } then you can access what you thought was data in the OP as: print $itsahash{"data"};