in reply to Save hash value?

If you indexed your players by name when you created the array, you wouldn't have to perform this expensive duplicate checking.

Replies are listed 'Best First'.
Re^2: Save hash value?
by toxicious (Initiate) on Jun 06, 2011 at 00:03 UTC
    ...say whut? Would you mind explaining more about that? What I need to do, is merge all dupes(the data of the entries), not just remove them. Btw, Anonymous Monk, now I get what you mean and it worked ;) thx!

      I assume you create @players somehow. If you have a loop in which you do so (or if you can arrange your code to create some sort of loop), you could make a hash instead of an array and write:

      my %players; while (my $player = make_next_player()) { if (exists $players{ $player->{name} } { # merge new player data with existing player } else { $players{ $player->{name} } = $player; } }