while (my $row = ) { push @arr, [ unpack "x0 A12 ..." => $row ]; } # @arr now holds a list of array refs $csv->print (OUT, $_) for @arr;