use strict; use warnings; use Text::CSV; my $csvData = <new( { binary => 1, auto_diag => 2 } ) or die "Cannot use CSV: " . Text::CSV->error_diag(); # Open the string like a file for reading open my $csvfh, '<', \$csvData or die $!; # Get first line (array reference to parsed column names) my $columnNames = $csv->getline($csvfh); # $row contains an array reference to the parsed csv line while ( my $row = $csv->getline($csvfh) ) { print "Col$_: $row->[$_]\n" for 0 .. 7; } close $csvfh;