Ok, dann der ganze Spaß eben nochmal in Perl:
Und sacht mir nich, dat et nich jeht !
Gruß
Code:
#!/usr/bin/perl
use warnings;
use strict;
if($#ARGV < 0)
{
print "Gimme a file-name!\n";
exit(1);
}
my $s = $ARGV[0];
open(FH, "<$s");
my @a = <FH>;
close(FH);
my %e = ();
my $i;
foreach $i (@a)
{
if($i =~ m/('.*' )/)
{
my $b = $1;
my @c = split($b, $i);
my $d = $c[1];
chomp($d);
if (exists $e{$b})
{
$e{$b} += $d;
}
else
{
$e{$b} = $d;
}
}
}
my @f = values(%e);
@f = sort { $b <=> $a } @f;
my %g = %e;
my $u;
for($i = 0; $i < 10; $i++)
{
foreach $u (keys %g)
{
if($f[$i] == $g{$u})
{
print "$u $g{$u}\n";
delete $g{$u};
last;
}
}
}
Gruß