# starting with @arr having all the lines my @ticker; my @names=('ticket','dateadded','stime','etime','pri','SiteName','comments'); my $i=0; foreach my $line (@arr) { my @items= split(/\|/, $line; print "ETime is $items[3]\n"; $ticker[$i]{$names{$_}}= $items[$_] for scalar @names; $i++; } # now $ticker[3]{SiteName} is SiteName of the fourth line