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


in reply to Re: cut vs split (suggestions)
in thread cut vs split (suggestions)

Some of the slowness appears to be related to the split, rather than the join. On my system, this takes about 9s:
$ time perl -lanF, -e 'print join ",", @F[0..14];' numbers.csv > /dev/ +null real 0m9.880s user 0m9.716s sys 0m0.034s
and your version takes a little less:
$ time perl -lanF, -e 'BEGIN{ $,=","} print @F[0..14];' numbers.csv > +/dev/null real 0m8.974s user 0m8.772s sys 0m0.042s
but this one avoiding both -a and join only takes about 3.4s:
$ time perl -ln -e 'print $1 if /((?:[^,]+,){14}[^,]+)/' numbers.csv > + /dev/null real 0m3.412s user 0m3.370s sys 0m0.031s