[perl #3242] [PATCH]No error on assignment to $>
[p5sagit/p5-mst-13.2.git] / pod / perlfaq7.pod
index a735edc..54e91bd 100644 (file)
@@ -1,6 +1,6 @@
 =head1 NAME
 
-perlfaq7 - General Perl Language Issues ($Revision: 1.15 $, $Date: 2003/07/24 02:17:21 $)
+perlfaq7 - General Perl Language Issues ($Revision: 1.18 $, $Date: 2004/11/03 22:54:08 $)
 
 =head1 DESCRIPTION
 
@@ -97,6 +97,16 @@ See L<perllexwarn> for more details.
        no warnings;          # temporarily turn off warnings
        $a = $b + $c;         # I know these might be undef
     }
+    
+Additionally, you can enable and disable categories of warnings.
+You turn off the categories you want to ignore and you can still
+get other categories of warnings.  See L<perllexwarn> for the
+complete details, including the category names and hierarchy.
+
+       {
+       no warnings 'uninitialized';
+       $a = $b + $c;
+       }
 
 If you have an older version of Perl, the C<$^W> variable (documented
 in L<perlvar>) controls runtime warnings for a block:
@@ -213,7 +223,7 @@ but encourages closures.
 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 +242,7 @@ value that the lexical had when the function was created.
 
     sub make_adder {
         my $addpiece = shift;
-        return sub { shift + $addpiece };
+        return sub { shift() + $addpiece };
     }
 
     $f1 = make_adder(20);
@@ -725,32 +735,27 @@ not necessarily the same as the one in which you were compiled):
 
 =head2 How can I comment out a large block of perl code?
 
-You can use embedded POD to discard it.  The =for directive
-lasts until the next paragraph (two consecutive newlines).
+You can use embedded POD to discard it.  Enclose the blocks you want
+to comment out in POD markers, for example C<=for nobody> and C<=cut>
+(which marks ends of POD blocks).
 
     # program is here
 
     =for nobody
-    This paragraph is commented out
-
-    # program continues
-
-The =begin and =end directives can contain multiple
-paragraphs.
-
-    =begin comment text
 
     all of this stuff
 
     here will be ignored
     by everyone
 
-    =end comment text
+    =cut
+
+    # program continues
 
 The pod directives cannot go just anywhere.  You must put a
 pod directive where the parser is expecting a new statement,
 not just in the middle of an expression or some other
-arbitrary s grammar production.
+arbitrary grammar production.
 
 See L<perlpod> for more details.