From: Gurusamy Sarathy Date: Sun, 19 Jul 1998 06:56:19 +0000 (+0000) Subject: add perltrap entry about "${#a}", as suggested by X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c12982c86a2196a797f6a6b78ff87ba73a7de7fe;p=p5sagit%2Fp5-mst-13.2.git add perltrap entry about "${#a}", as suggested by andy barfoot p4raw-id: //depot/perl@1559 --- diff --git a/pod/perltrap.pod b/pod/perltrap.pod index 1b954a3..852d8e9 100644 --- a/pod/perltrap.pod +++ b/pod/perltrap.pod @@ -650,6 +650,23 @@ Better parsing in perl 5 # perl4 prints: is zero # perl5 warns: "Useless use of a constant in void context" if using -w +=item * Parsing + +String interpolation of the C<$#array> construct differs when braces +are to used around the name. + + @ = (1..3); + print "${#a}"; + + # perl4 prints: 2 + # perl5 fails with syntax error + + @ = (1..3); + print "$#{a}"; + + # perl4 prints: {a} + # perl5 prints: 2 + =back =head2 Numerical Traps