Theseus has asked for the wisdom of the Perl Monks concerning the following question:
I know I could create a subroutine that sorted the array and then shifted the undefs off, but I need to be able to do this without altering the order of the array(besides eliminating undefs and collapsing the array to fill in the empty space). Any help would be appreciated, thanks.my @array = ("index0","index1","index2","index3","index4"); delete $array[2]; # @array is now ("index0","index1",undef,"index3","index4") # but what I wanted was: # @array = ("index0","index1","index3","index4");
|
---|
Replies are listed 'Best First'. | |
---|---|
(zdog) Re: Array question
by zdog (Priest) on Jul 10, 2002 at 16:34 UTC | |
Re: Array question
by Abigail-II (Bishop) on Jul 10, 2002 at 16:35 UTC | |
Re: Array question
by sschneid (Deacon) on Jul 10, 2002 at 16:36 UTC | |
Re: Array question
by bronto (Priest) on Jul 10, 2002 at 17:05 UTC | |
by Theseus (Pilgrim) on Jul 10, 2002 at 20:44 UTC | |
by bronto (Priest) on Jul 11, 2002 at 08:22 UTC |