Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
foreach my $item (@list) {
... code
}
however the code inside the loop is appending new information to the end of the list but I want to avoid duplicate entries so I'm having to loop over the list to check if the new item isn't already in the list. The program is, obviously, getting slower the longer the list gets.
while(my($item, $ummy) = each(%hash)) {
... code
}
only processed the values that were in the hash when it was created and ignores those that are being added as the code is run.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: best data structure
by rob_au (Abbot) on Aug 28, 2002 at 13:27 UTC | |
|
Re: best data structure
by digiryde (Pilgrim) on Aug 28, 2002 at 17:19 UTC | |
|
Re: best data structure
by RollyGuy (Chaplain) on Aug 28, 2002 at 13:33 UTC | |
by fruiture (Curate) on Aug 28, 2002 at 14:29 UTC | |
by rob_au (Abbot) on Aug 28, 2002 at 13:58 UTC | |
|
Re: best data structure
by thelenm (Vicar) on Aug 28, 2002 at 15:34 UTC |