%mdata = ( $pkey => { ABC => trim_trailing($rec[1]), DESC => trim_trailing($rec[2]), UNIT => trim_trailing($rec[3]), LOC => trim_trailing($rec[4]) } ) #### $mdata{$pkey} = { ABC => trim_trailing($rec[1]), DESC => trim_trailing($rec[2]), UNIT => trim_trailing($rec[3]), LOC => trim_trailing($rec[4]) }; #### next unless (s/\^/\^/g == 4); my @rec = split /\^/; #### my @rec = split /\^/; next unless @rec == 5;