while ( my $row = $csv_in->getline($fh_in) ) { # print out each line you visit during the while loop local $"='|'; print STDERR "<@$row>\n"; $csv_out->print( $fh_out, [ @$row[ 2, 3, 0, 4 ], ] ); }