Optional parameters: Difference between revisions

Content added Content deleted
(→‎{{header|Perl}}: add Perl 6 entry)
Line 803: Line 803:


=={{header|Perl}}==
=={{header|Perl}}==
Perl has no formal parameters, so all function arguments must be processed in the function body.
Perl 5 has no formal parameters, so all function arguments must be processed in the function body.


This function expects its first argument to be a reference to an array of arrays. It interprets any remaining arguments as a hash of optional parameters.
This function expects its first argument to be a reference to an array of arrays. It interprets any remaining arguments as a hash of optional parameters.
Line 825: Line 825:
{printf "%-5s", $_;}
{printf "%-5s", $_;}
print "\n";}</lang>
print "\n";}</lang>
=={{header|Perl 6}}==
<lang perl6>method sorttable(:$column = 0, :$reverse, :&ordering = &cmp) {
my @result = self»[$column].sort: &ordering;
return $reverse ?? @result.reverse !! @result;
}</lang>


=={{header|PicoLisp}}==
=={{header|PicoLisp}}==