X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/0f2dddf9d5446ead8d477e583a8d2c0191df31e1..ad4795e78e923065898354b946437030aaeca163:/pod/perltrap.pod diff --git a/pod/perltrap.pod b/pod/perltrap.pod index 3569709..99e25c8 100644 --- a/pod/perltrap.pod +++ b/pod/perltrap.pod @@ -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 prototyped as C<($;@)>