summaryrefslogtreecommitdiff
path: root/pod/perltrap.pod
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-07-19 06:56:19 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-07-19 06:56:19 +0000
commitc12982c86a2196a797f6a6b78ff87ba73a7de7fe (patch)
tree5f98b057f8adc37d87713b1383abecd5052b93df /pod/perltrap.pod
parent9b6570b4f9243e4e8b953fb4650b22aab639eabc (diff)
downloadperl-c12982c86a2196a797f6a6b78ff87ba73a7de7fe.tar.gz
add perltrap entry about "${#a}", as suggested by
andy barfoot <abarfoot@eng.auburn.edu> p4raw-id: //depot/perl@1559
Diffstat (limited to 'pod/perltrap.pod')
-rw-r--r--pod/perltrap.pod17
1 files changed, 17 insertions, 0 deletions
diff --git a/pod/perltrap.pod b/pod/perltrap.pod
index 1b954a357d..852d8e9826 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