From: Chas. Owens Date: Wed, 9 Jun 2010 15:43:46 +0000 (-0400) Subject: Document $# and $* as removed X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f315d2e5ecf9c2453606c348568dc73e5e4d390;p=p5sagit%2Fp5-mst-13.2.git Document $# and $* as removed See email thread for reference: http://www.nntp.perl.org/group/perl.perl5.porters/2010/06/msg160812.html --- diff --git a/pod/perlvar.pod b/pod/perlvar.pod index ed90610..0b31330 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -1629,6 +1629,45 @@ L for additional information. =back +=head2 Names that are no longer special + +These variables had special meaning in prior versions of Perl but now +have no effect and will cause warnings if used. They are included +here for historical reference. + +=over 8 + +=item $# +X<$#> + +C<$#> used to be a variable that could be used to format printed numbers. +After a deprecation cycle, its magic was removed in Perl 5.10 and using it +now triggers a warning: C<$# is no longer supported>. + +C<$#> is also used as sigil, which, when prepended on the name of an +array, gives the index of the last element in that array. + + my @array = ("a", "b", "c"); + my $last_index = $#array; # $last_index is 2 + + for my $i (0 .. $#array) { + print "The value of index $i is $array[$i]\n"; + } + +Also see L. + +=item $* +X<$*> + +C<$*> used to be a variable that enabled multiline matching. +After a deprecation cycle, its magic was removed in Perl 5.10. +Using it now triggers a warning: C<$* is no longer supported>. +Use the C and C regexp modifiers instead. + +Also see L. + +=back + =head2 Error Indicators X X