$xNeTworKx: ?....? bei Hash, wie push bei Liste ?

Beitrag lesen

Hallo,

$postinghash{$unixzeit} = $_;

my @sort = sort { $a <=> $b } keys %postinghash;

my @topzwens = splice(@sort, 0, 19);

foreach my $unixtime (@topzwens) {
   my $related_file = $postinghash{$unixtime};
}

Das verstehe ich alles, danke..

ach ja, das setzt voraus, dass jede mögliche unixtime wirklich nur einmal vorkommt, sonst gehen gleiche unixtimes verloren.

unless (ref($postinghash{$unixzeit}) eq 'ARRAY') {
   $postinghash{$unixzeit} = [];
}
push @{$postinghash{$unixzeit}}, $_;

Aber das irgendwie nicht so ganz :)

$xNeTworKx.