in reply to Re^2: Save hash value?
in thread Save hash value?
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; } }
|
|---|