sub _moredata_array { my ($datastring, $datasep_cfg) = @_; use Text::CSV; my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1, sep_char => "$datasep_cfg" }); my $io; open ($io, "<:encoding(utf8)", \$datastring) or die "Cannot use CSV: $!".Text::CSV->error_diag (); my $row = $csv->getline ($io); $row || undef; } sub _moredata_hash { my ($datastring, $hashsep) = @_; use Text::CSV; my $csv = Text::CSV->new ({ binary => 1, auto_diag => 1, sep_char => "$hashsep" }); my $io; open ($io, "<:encoding(utf8)", \$datastring) or die "Cannot use CSV: $!".Text::CSV->error_diag (); my %hash; while (my $colref = $csv->getline($io)) { my $count = scalar @{$colref}; die "$count is an odd number of keys and values at @{$colref}.\n" if ($count%2); $hash{$colref->[0]} = $colref->[1]; } scalar %hash ? \%hash : undef; }