blueAdept has asked for the wisdom of the Perl Monks concerning the following question:
my $x; my $counter; for($x = 0; $x < @{$mon_obj->{'FILE_DATA'}}; $x++) { unless($mon_obj->{'FILE_DATA'}->[$x]) ## if undef incr. the gap { $counter++; } if($counter > 0) ## copy the data from $x + gap to $x { $mon_obj->{'FILE_DATA'}->[$x] = $mon_obj->{'FILE_DATA'}->[$x + $c +ounter]; } } for($x = 0; $x < $counter; $x++) { pop @{$mon_obj->{'FILE_DATA'}; ## pop into oblivion }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: deleting array elements(efficiency/critique)
by chipmunk (Parson) on Dec 27, 2000 at 20:50 UTC | |
by blueAdept (Beadle) on Dec 27, 2000 at 23:14 UTC | |
|
Re: deleting array elements(efficiency/critique)
by I0 (Priest) on Dec 27, 2000 at 20:50 UTC | |
by davorg (Chancellor) on Dec 27, 2000 at 20:56 UTC | |
by I0 (Priest) on Dec 27, 2000 at 21:33 UTC | |
|
Re: deleting array elements(efficiency/critique)
by ichimunki (Priest) on Dec 27, 2000 at 21:24 UTC | |
|
Re: deleting array elements(efficiency/critique)
by repson (Chaplain) on Dec 31, 2000 at 06:58 UTC |