use strict; use warnings; my @names; my @comments; my %hrec; while (){ chomp; my ($name,$comment) = split ","; $name =~ s/"//g; $comment =~ s/"//g; push @names,$name; push @comments,$comment; } $hrec{'Names'} = @names; $hrec{'Comments'} = @comments;