use strict; use warnings; open my $fh, 'data.txt' or die "Can't read data.txt: $!\n"; my %stuff; while (<$fh>) { chomp; my ($short, $place) = split /\|/, $_; $stuff{$short} = $place; } close $fh;