From c12982c86a2196a797f6a6b78ff87ba73a7de7fe Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Sun, 19 Jul 1998 06:56:19 +0000 Subject: [PATCH] add perltrap entry about "${#a}", as suggested by andy barfoot p4raw-id: //depot/perl@1559 --- pod/perltrap.pod | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 -- 2.7.4