[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Removing an element from an array



On 11/30/99 at 7:11 AM, jakal wrote:

: What is the best way to remove an element from the middle of an array?
: 
: For example, if I have an array containing the ten lines of a text file,
: one line in each element of the array, and I want to delete line $x from
: the file, what is the best wau to do it?
: 


use splice:

splice(@lines, $x, 1);

Now, @lines contains the array minus the $x'th element.

Don



# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org