use Text::CSV_XS; use IO::File; # tell/seek fails if i omit this line my $file = "1,2,3\n4,5,6\n7,8,9\n10,11,12\n13,14,15"; open (my $io, '<', \$file); # Open filehandle to in memory file my $csv = Text::CSV_XS->new(); while (1) { my $start = tell($io); my $colref = $csv->getline($io); last unless $colref; print "Array: @$colref\n"; my $length = tell($io) - $start; seek($io, $start, 0); read($io, my $string, $length); print "String: <$string>\n"; }