This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #47365] Docs for \$ prototypes
authorFather Chrysostomos <sprout@cpan.org>
Tue, 21 Sep 2010 05:29:03 +0000 (22:29 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 21 Sep 2010 05:29:03 +0000 (22:29 -0700)
\$ allows any hash/array element, even if it does not start with a
dollar sign.

pod/perlsub.pod

index 93f6e5f..9121519 100644 (file)
@@ -1093,9 +1093,12 @@ corresponding built-in.
     sub mytime ()           mytime
 
 Any backslashed prototype character represents an actual argument
-that absolutely must start with that character.  The value passed
-as part of C<@_> will be a reference to the actual argument given
-in the subroutine call, obtained by applying C<\> to that argument.
+that must start with that character (optionally preceded by C<my>,
+C<our> or C<local>), with the exception of C<$>, which will accept a
+hash or array element even without a dollar sign, such as
+C<my_function()->[0]>. The value passed as part of C<@_> will be a
+reference to the actual argument given in the subroutine call,
+obtained by applying C<\> to that argument.
 
 You can also backslash several argument types simultaneously by using
 the C<\[]> notation: