Largest int from concatenated ints: Difference between revisions

→‎{{header|Perl 6}}: correctness (sort was reversed) and style tweaks
(→‎{{header|C++}}: incorrect)
(→‎{{header|Perl 6}}: correctness (sort was reversed) and style tweaks)
Line 282:
 
=={{header|Perl 6}}==
<lang Perl6perl6>sub maxnum(@x) {
[~] @x.sort: -> $xa, $yb { $xb ~ $ya <=> $ya ~ $xb }, @x
}
 
say maxnum .[]<1 for34 3 98 9 76 45 4>;
[say maxnum <54 546 548 60>];</lang>
[<1 34 3 98 9 76 45 4>],
[<54 546 548 60>];</lang>
{{out}}
<pre>998764543431
Anonymous user