summaryrefslogtreecommitdiff
path: root/pod/perlsub.pod
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-08-15 09:20:08 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-08-15 12:47:33 -0700
commit3a8944db48a72ff3e936211f8b0433b10f3c6c80 (patch)
tree919125170fd024751e0c8576f6ed3c04505bc2ee /pod/perlsub.pod
parentf2f8fd84e14dfcfc614b0ccf9b24475ca5f173d4 (diff)
downloadperl-3a8944db48a72ff3e936211f8b0433b10f3c6c80.tar.gz
Document and test $; prototype syntax
This has worked this way for yonks. It is actually useful, so it might as well be documented.
Diffstat (limited to 'pod/perlsub.pod')
-rw-r--r--pod/perlsub.pod6
1 files changed, 5 insertions, 1 deletions
diff --git a/pod/perlsub.pod b/pod/perlsub.pod
index d344c4745c..e2a9bcfaf5 100644
--- a/pod/perlsub.pod
+++ b/pod/perlsub.pod
@@ -1149,7 +1149,11 @@ arguments, just like C<time()>. That is, if you say
mytime +2;
you'll get C<mytime() + 2>, not C<mytime(2)>, which is how it would be parsed
-without a prototype.
+without a prototype. If you want to force a unary function to have the
+same precedence as a list operator, add C<;> to the end of the prototype:
+
+ sub mygetprotobynumber($;);
+ mygetprotobynumber $a > $b; # parsed as mygetprotobynumber($a > $b)
The interesting thing about C<&> is that you can generate new syntax with it,
provided it's in the initial position: