diff options
author | Chip Salzenberg <chip@perl.com> | 1997-04-30 00:00:00 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1997-04-30 00:00:00 +1200 |
commit | 6da72b644b845971d5b417f3c6f5590e23084bcd (patch) | |
tree | 322d1e0b1a154d0b12f1fcc49838fe9a9aa4288c /pod/perlref.pod | |
parent | 404b15a1d1b7c56f5774b99fd0d4b6854620182b (diff) | |
download | perl-6da72b644b845971d5b417f3c6f5590e23084bcd.tar.gz |
Support C< $coderef->($x,$y) >
Randal Schwartz said:
> Some time in October, 1994, Larry Wall said:
> > : All other references you can follow with ->, what about code refs?
> > Aw, look, I'd really like that feature in, but I think it's a bit
> > too close to the release for that.
> Hey Chip,
> Look, Larry said he'd really like that feature
Larry said that? That change is like two lines, it's in!
Tricked-into-doing-by: Randal Schwartz <merlyn@stonehenge.com>
Diffstat (limited to 'pod/perlref.pod')
-rw-r--r-- | pod/perlref.pod | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/pod/perlref.pod b/pod/perlref.pod index cf793652f7..6aa086088d 100644 --- a/pod/perlref.pod +++ b/pod/perlref.pod @@ -318,14 +318,15 @@ it's presumably referencing. That would be case 3. =item 3. -The case of individual array elements arises often enough that it gets -cumbersome to use method 2. As a form of syntactic sugar, the two -lines like that above can be written: +Subroutine calls and lookups of individual array elements arise often +enough that it gets cumbersome to use method 2. As a form of +syntactic sugar, the examples for method 2 may be written: - $arrayref->[0] = "January"; - $hashref->{"KEY"} = "VALUE"; + $arrayref->[0] = "January"; # Array element + $hashref->{"KEY"} = "VALUE"; # Hash element + $coderef->(1,2,3); # Subroutine call -The left side of the array can be any expression returning a reference, +The left side of the arrow can be any expression returning a reference, including a previous dereference. Note that C<$array[$x]> is I<NOT> the same thing as C<$array-E<gt>[$x]> here: |