This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix use of == to compare strings in perlref.pod
authorDagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Tue, 15 Dec 2015 23:45:00 +0000 (23:45 +0000)
committerKarl Williamson <khw@cpan.org>
Wed, 16 Dec 2015 00:31:07 +0000 (17:31 -0700)
pod/perlref.pod

index e570b72..5804c17 100644 (file)
@@ -887,7 +887,7 @@ for obfuscated code:
     # @harry is (1,2,3)
 
     my $type = ref $thingy;
-    ($type ? $type == 'ARRAY' ? \@foo : \$bar : $baz) = $thingy;
+    ($type ? $type eq 'ARRAY' ? \@foo : \$bar : $baz) = $thingy;
 
 The C<foreach> loop can also take a reference constructor for its loop
 variable, though the syntax is limited to one of the following, with an
@@ -906,7 +906,7 @@ arrays-of-arrays, or arrays-of-hashes:
     }
 
     foreach \my %h (@array_of_hashes) {
-        $h{gelastic}++ if $h{type} == 'funny';
+        $h{gelastic}++ if $h{type} eq 'funny';
     }
 
 B<CAVEAT:> Aliasing does not work correctly with closures.  If you try to