Re: splicing and empty rows
- From: ArtÅras Ålajus <x11 h2o pieva net>
- To: muppet <scott asofyet org>
- Cc: gtk-perl list <gtk-perl-list gnome org>
- Subject: Re: splicing and empty rows
- Date: Sat, 13 Dec 2003 19:51:56 +0200
muppet wrote:
you actually need to do this:
sub del_user {
my $bywhat = shift;
for (0 {$UserList->{'data'}}-1) {
if ($UserList->{data}[$_][1] eq $bywhat) {
splice @{$UserList->{'data'}}, $_, 1;
last; # stop!
}
}
update_busers();
}
in general, if you need to modify the list while traversing it, and may
be removing elements, either traverse it from back to front, or start
over after every modification.
Thanks for explanation and code. That worked fine!
--
Sincerely, ArtÅras 'arturaz' Ålajus
You can find me at:
irc.freenode.org: nick arturaz
irc.data.lt: nick arturaz
ICQ: 157929934
Jabber: arturaz akl lt
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]