open my $fh, '<', 'sample.data' or die $!; while (<$fh>) { # chomp # split # assign to hash } close $fh;