This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Don't explicitly talk about our support for DBM files as a feature.
[perl5.git] / pod / perltrap.pod
index 936d684..99e25c8 100644 (file)
@@ -170,8 +170,8 @@ C<do { } while> construct.  See L<perlsyn/"Loop Control">.
 
 =item *
 
-There's no switch statement.  (But it's easy to build one on the fly,
-see L<perlsyn/"Basic BLOCKs and Switch Statements">)
+The switch statement is called C<given/when> and only available in
+perl 5.10 or newer. See L<perlsyn/"Switch statements">.
 
 =item *
 
@@ -448,8 +448,8 @@ Given that C<::> is now the preferred package delimiter, it is debatable
 whether this should be classed as a bug or not.
 (The older package delimiter, ' ,is used here)
 
-    $x = 10 ;
-    print "x=${'x}\n" ;
+    $x = 10;
+    print "x=${'x}\n";
 
     # perl4 prints: x=10
     # perl5 prints: Can't find string terminator "'" anywhere before EOF
@@ -457,8 +457,8 @@ whether this should be classed as a bug or not.
 You can avoid this problem, and remain compatible with perl4, if you
 always explicitly include the package name:
 
-    $x = 10 ;
-    print "x=${main'x}\n" ;
+    $x = 10;
+    print "x=${main'x}\n";
 
 Also see precedence traps, for parsing C<$:>.
 
@@ -665,13 +665,13 @@ are to used around the name.
     # perl4 prints: 2
     # perl5 fails with syntax error
 
-    @ = (1..3);
+    @a = (1..3);
     print "$#{a}";
 
     # perl4 prints: {a}
     # perl5 prints: 2
 
-=item * Perl guesses on C<map>, C<grep> followed by C<{> whether C<{> starts BLOCK or hash ref
+=item * Perl guesses on C<map>, C<grep> followed by C<{> if it starts BLOCK or hash ref
 
 When perl sees C<map {> (or C<grep {>), it has to guess whether the C<{>
 starts a BLOCK or a hash reference. If it guesses wrong, it will report
@@ -704,7 +704,7 @@ tries to be more precise.  For example, on a Solaris Sparc:
 
     # Perl5 prints:
     7.373504
-    7.375039999999999614
+    7.373503999999999614
 
 Notice how the first result looks better in Perl 5.
 
@@ -720,7 +720,7 @@ If in doubt:
 
    use Math::BigInt;
 
-=item * Assignment of return values from numeric equality tests doesn't works
+=item * Assignment of return values from numeric equality tests doesn't work
 
 Assignment of return values from numeric equality tests
 does not work in perl5 when the test evaluates to false (0).
@@ -960,14 +960,15 @@ being required.
 =item * Comma operator in scalar context gives scalar context to args
 
 The comma operator in a scalar context is now guaranteed to give a
-scalar context to its arguments.
+scalar context to its last argument. It gives scalar or void context
+to any preceding arguments, depending on circumstances.
 
     @y= ('a','b','c');
     $x = (1, 2, @y);
     print "x = $x\n";
 
-    # Perl4 prints:  x = c   # Thinks list context interpolates list
-    # Perl5 prints:  x = 3   # Knows scalar uses length of list
+    # Perl4 prints:  x = c   # Interpolates array @y into the list
+    # Perl5 prints:  x = 3   # Evaluates array @y in scalar context
 
 =item * C<sprintf()> prototyped as C<($;@)>
 
@@ -1219,7 +1220,7 @@ C<[$opt]> is a character class in perl4 and an array subscript in perl5
     $opt  = 'r';
     $_ = 'bar';
     s/^([^$grpc]*$grpc[$opt]?)/foo/;
-    print ;
+    print;
 
     # perl4 prints: foo
     # perl5 prints: foobar
@@ -1258,7 +1259,7 @@ general subroutine traps.  Includes some OS-Specific traps.
 
 =over 5
 
-=item * Barewords that used to look like strings look like subroutine calls if a subroutine by that name is defined
+=item * Barewords that used to look like strings look like subroutine calls
 
 Barewords that used to look like strings to Perl will now look like subroutine
 calls if a subroutine by that name is defined before the compiler sees them.
@@ -1334,11 +1335,11 @@ for append,  it  is  impossible to overwrite information already in
 the file.
 
     open(TEST,">>seek.test");
-    $start = tell TEST ;
+    $start = tell TEST;
     foreach(1 .. 9){
         print TEST "$_ ";
     }
-    $end = tell TEST ;
+    $end = tell TEST;
     seek(TEST,$start,0);
     print TEST "18 characters here";
 
@@ -1378,7 +1379,7 @@ Double-quoted strings may no longer end with an unescaped $.
 
 Note: perl5 DOES NOT error on the terminating @ in $bar
 
-=item * Arbitrary expressions are evaluated inside braces that occur within double quotes
+=item * Arbitrary expressions are evaluated inside braces within double quotes
 
 Perl now sometimes evaluates arbitrary expressions inside braces that occur
 within double quotes (usually when the opening brace is preceded by C<$>
@@ -1407,7 +1408,7 @@ now tries to dereference $x.  C<$$> by itself still works fine, however.
     # perl4 prints: this is XXXx   (XXX is the current pid)
     # perl5 prints: this is a reference
 
-=item * Creation of hashes on the fly with C<eval "EXPR"> requires protection of C<$>'s or both curlies
+=item * Creation of hashes on the fly with C<eval "EXPR"> requires protection
 
 Creation of hashes on the fly with C<eval "EXPR"> now requires either both
 C<$>'s to be protected in the specification of the hash name, or both curlies
@@ -1514,7 +1515,7 @@ General DBM traps.
 
 =over 5
 
-=item * Perl5 must have been linked with the same dbm/ndbm as the default for C<dbmopen()> to function properly without C<tie>'ing
+=item * Perl5 must have been linked with same dbm/ndbm as the default for C<dbmopen()>
 
 Existing dbm databases created under perl4 (or any other dbm/ndbm tool)
 may cause the same script, run under perl5, to fail.  The build of perl5
@@ -1528,7 +1529,7 @@ to function properly without C<tie>'ing to an extension dbm implementation.
     # perl5 prints: ok (IFF linked with -ldbm or -lndbm)
 
 
-=item * DBM exceeding the limit on the key/value size will cause perl5 to exit immediately
+=item * DBM exceeding limit on the key/value size will cause perl5 to exit immediately
 
 Existing dbm databases created under perl4 (or any other dbm/ndbm tool)
 may cause the same script, run under perl5, to fail.  The error generated