On Monday 05 November 2007 11:25, Tom Phoenix wrote: > On 11/5/07, Patrik Hasibuan <[EMAIL PROTECTED]> wrote: > > > > [EMAIL PROTECTED]; > > splice(@k,0,$z); > > If I'm not mistaken, that splice() is the hard way to write this: > > unshift @k, $z; > > > [EMAIL PROTECTED]; > > splice(@k_isi,0,$z); > > } > > ...but what are you doing with $z? It seems that you're putting the > number of elements in the array onto the start of the array. That's > odd. That would imply that these arrays will be passed out of Perl;
Wow. I guess you haven't used splice() in a while Tom. These examples all do the same thing (clear out the array @k): 1) $z = @k; splice @k, 0, $z, (); 2) $z = @k; splice @k, 0, $z; 3) splice @k, 0; 4) splice @k; 5) @k = (); 6) $#k = -1; (splice also returns a list of the elements that were removed.) John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/