irgendwas machst du falsch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl
use strict;
use warnings;
my @array = map { A->new($_) } 1..100;
sub backward { $b->value <=> $a->value }
mysort(\&backward);
sub mysort {
my $func = shift;
print join("\n", map { $_->value } sort $func @array);
}
package A;
sub new {
my $class = shift;
my $val = shift;
return bless [$val], $class;
}
sub value {
my $class = shift;
return $class->[0];
}
1;