in reply to Removing an element from an array

1) map the array elements to a hash, delete the key of the element you want to remove and map them back to an array.
my @array = ("zero", "one", "two", "three", "four"); my %hash = map { $_ => "1" } @array; delete $hash{"two"}; @array = keys %hash; print "@array\n";
Note that you won't get the keys out of a hash in the order you put them in unless you use a tied hash.

2) If you know the array index, use array slices.

my @array = ("zero", "one", "two", "three", "four"); my $remove = 2; # let's remove 2! @array = (@array[0 .. ($remove - 1)], @array[($remove + 1) .. $#array] +); print "\n@array\n"; print $array[0], "\n", $array[3];