use strict; use Data::Dumper; my %hoa; while() { chomp; my($k, $v) = split /\s*:\s*/ => $_, 2; $hoa{$k} = [ split ';' => $v ]; } print Dumper(\%hoa); __DATA__ t-98: 12;3;56;24 t-56: 1;98 t-3 : 12;56