#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hoh; while(){ my $line=$_; chomp($line); my @values=split(/,/,$line); my @type_val=splice(@values,3,2); my ($type_value,$key_type)=split(/\./,$values[2]); $hoh{$key_type}{$type_value} = [@type_val]; } print Dumper \%hoh; __DATA__ abc,def,excel1.xls,12,some,time hj,uyi,excel2.xls,12,more,time2 #### ---------- Capture Output ---------- > "c:\perl\bin\perl.exe" _new.pl $VAR1 = { 'xls' => { 'excel2' => [ '12', 'more' ], 'excel1' => [ '12', 'some' ] } }; > Terminated with exit code 0.