summaryrefslogtreecommitdiff
path: root/pod/perlfunc.pod
diff options
context:
space:
mode:
authorNicolas R <nicolas@atoomic.org>2022-01-17 17:08:55 -0700
committerℕicolas ℝ <nicolas@atoomic.org>2022-01-20 13:21:34 -0700
commit3816fd62ef8f82c5d236958e95453521d5df0133 (patch)
tree69e1db840ffce81a854c09b491e557a3eb0051ac /pod/perlfunc.pod
parent9bfb09e8f10521a5baac0bf5fde6a4efcb703f23 (diff)
downloadperl-3816fd62ef8f82c5d236958e95453521d5df0133.tar.gz
Add a pod sort sample with function signature
GH #19344 Provide a sample for sort using function signature.
Diffstat (limited to 'pod/perlfunc.pod')
-rw-r--r--pod/perlfunc.pod8
1 files changed, 8 insertions, 0 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 762f12cb72..26d59a580e 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -7680,6 +7680,14 @@ Examples:
package main;
my @new = sort Other::backwards @old;
+ ## using a prototype with function signature
+ use feature 'signatures';
+ sub function_with_signature :prototype($$) ($one, $two) {
+ return $one <=> $two
+ }
+
+ my @new = sort function_with_signature @old;
+
# guarantee stability
use sort 'stable';
my @new = sort { substr($a, 3, 5) cmp substr($b, 3, 5) } @old;