Skip to content

Commit

Permalink
[S06] only add @_ and %_ to default sig if actually used in body
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.pugscode.org/pugs@27801 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information
lwall committed Jul 29, 2009
1 parent 4056b80 commit 895607e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions S06-routines.pod
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Synopsis 6: Subroutines

Created: 21 Mar 2003

Last Modified: 26 Jun 2009
Version: 110
Last Modified: 29 Jul 2009
Version: 111


This document summarizes Apocalypse 6, which covers subroutines and the
Expand Down Expand Up @@ -125,10 +125,15 @@ You can declare a sub without parameter list, as in Perl 5:

sub foo {...}

This is equivalent to
This is equivalent to one of:

sub foo () {...}
sub foo (*@_) {...}
sub foo (*%_) {...}
sub foo (*@_, *%_) {...}

depending on whether either or both of those variables are used in the body of the routine.

Positional arguments implicitly come in via the C<@_> array, but
unlike in Perl 5 they are C<readonly> aliases to actual arguments:

Expand Down

0 comments on commit 895607e

Please sign in to comment.