chuleto1 has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way to have this done in an easier way?
And have the array collapse shrink?
(i.e. if the array size is 10 when this happens '@array[count] = "";' have the array size shrink to size 9)?
And have the array collapse shrink?
(i.e. if the array size is 10 when this happens '@array[count] = "";' have the array size shrink to size 9)?
$count = 0; $item = "match"; foreach $element (@array) { if($element eq $item) { @array[count] = ""; } count++; }
Edit by myocom: Added code tags
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Deleting elements from array questions
by thelenm (Vicar) on Aug 08, 2002 at 18:06 UTC | |
Re: Deleting elements from array questions
by DamnDirtyApe (Curate) on Aug 08, 2002 at 18:08 UTC | |
Re: Deleting elements from array questions
by Zaxo (Archbishop) on Aug 08, 2002 at 18:09 UTC | |
by sauoq (Abbot) on Aug 08, 2002 at 18:25 UTC | |
Re: Deleting elements from array questions
by robobunny (Friar) on Aug 08, 2002 at 18:36 UTC | |
Re: Deleting elements from array questions
by aufrank (Pilgrim) on Aug 08, 2002 at 18:31 UTC |
Back to
Seekers of Perl Wisdom