And it fails complaining some scope::$a,$b not defined (with my). The question is, how can I make this work? How can Perl's sort avoid this kind of problems? Daniel.package Foo; ... sub sort(&) { my $self = shift; my $code = \&{shift @_}; sort $code @{$self->{arrayref}}; } my $foo = Foo->new; ... $foo->sort({ lc($a) cmp lc($b) });
In reply to relaying sort's code block by ttdsuen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |