use strict; use warnings; use Data::Dumper; my %zipDB = (); while ( ) { chomp; my ($zip, $state, $areaCode, $city) = unpack q{A5 A2 A3 A*}, $_; $zipDB{$zip} = join q{|}, $state, $areaCode, $city; } print Data::Dumper->Dumpxs([\%zipDB], [qw{*zipDB}]); __END__ 00601PR787ADJUNTAS 00602PR787AGUADA 00603PR787AGUADILLA 00604PR787AGUADILLA 00605PR787AGUADILLA 00606PR787MARICAO 00610PR787ANASCO 00611PR787ANGELES 00612PR787ARECIBO 00613PR787ARECIBO