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


in reply to Re^3: selecting columns from a tab-separated-values file
in thread selecting columns from a tab-separated-values file

Great job there Lotus1.

I'm curious about the use of splice to clear the array in your code, as below:

    splice( @$aref );

I would probably have used the below:

    @$aref = ();

Is splice faster or better in some other way?

Replies are listed 'Best First'.
Re^5: selecting columns from a tab-separated-values file
by Lotus1 (Priest) on Jan 25, 2013 at 02:23 UTC

    Thanks. I started with assigning the empty array but I had a bug somewhere so I stuck the splice in and got it working. I think I forgot the '@' in the first try but put it in with splice. I don't know which is faster but it is only called a handful of times in this approach anyway.