open(FH, "gp1data.txt") || die("Cannot open the file."); print "$_"; while (){ print "$_"; } my %menu; while (my $line2 = <$prices>) { chomp $line2; my @row = split(/-/, $line2); $menu{$row[0]} = $row[1]; }