#!/usr/bin/perl -w use strict; use Data::Dumper; my @col_def = qw/ id name street city zip phone start_dt /; my %ACCTS; open(IN, "< myfile") or die "Help!\n"; while () { chomp; # need to remove \n character, otherwise last # field will contain \n my @cols = split /\|\|/; $ACCTS{$cols[0]} = { map { $col_def[$_] => $cols[$_] } 1..$#col_def }; } close IN; print Dumper(\%ACCTS);