cvs commit: perlfaq perlfaq7.pod
[email protected] (brian d foy) 19 Oct 2004 22:53:50 -0000
| Newsgroups | perl.cvs.perlfaq |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 04/10/19 15:53:50 Modified: . perlfaq7.pod Log: * fixed warning identified by Michele Dondi <[email protected]> in comp.lang.perl.misc <[email protected]> The code in "What's a closure" produces this warning: Warning: Use of "shift" without parentheses is ambiguous at I added () to the shifts used in those examples. We could probably just have better examples though. Revision Changes Path 1.17 +3 -3 perlfaq/perlfaq7.pod Index: perlfaq7.pod =================================================================== RCS file: /cvs/public/perlfaq/perlfaq7.pod,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -r1.16 -r1.17 --- perlfaq7.pod 25 Sep 2003 17:44:58 -0000 1.16 +++ perlfaq7.pod 19 Oct 2004 22:53:50 -0000 1.17 @@ -1,6 +1,6 @@ =head1 NAME -perlfaq7 - General Perl Language Issues ($Revision: 1.16 $, $Date: 2003/09/25 17:44:58 $) +perlfaq7 - General Perl Language Issues ($Revision: 1.17 $, $Date: 2004/10/19 22:53:50 $) =head1 DESCRIPTION @@ -213,7 +213,7 @@ Here's a classic function-generating function: sub add_function_generator { - return sub { shift + shift }; + return sub { shift() + shift() }; } $add_sub = add_function_generator(); @@ -232,7 +232,7 @@ sub make_adder { my $addpiece = shift; - return sub { shift + $addpiece }; + return sub { shift() + $addpiece }; } $f1 = make_adder(20);