http://www.perlmonks.org?node_id=448560


in reply to cut vs split (suggestions)

For your perl test, try using.

perl -lanf, -e 'BEGIN{ $,=','} print @F[0,14];' numbers.csv >out.csv

It may be that at least a part of the difference is the process of joining the values from the slice, before printing them. By setting $, = ',';, you acheive the same affect without forcing perl to build a single concatenation of the values before passing them to print.

I don't have a feel for how big a difference it will make, but it's worth trying.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco.
Rule 1 has a caveat! -- Who broke the cabal?