my $mysort = sub { return $a <=> $b; }; print sort $mysort (1, 2, 3, 2, 1);