while () { chomp; my @fields = split(/$sep/, $_); my %data; @data{@fieldnames} = @fields; push @datalist, %data; }