diff options
author | Zefram <zefram@fysh.org> | 2011-09-09 23:27:16 +0100 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2011-09-09 23:30:02 +0100 |
commit | e1dccc0d34a90e3511bfed596be9d78128ca7ee7 (patch) | |
tree | 1e72ad2098f66ac1c59debfc46c00d1013fc0a9f /pod/perlvar.pod | |
parent | 0b31f5359876e6c0b203006714db218d7b441cd1 (diff) | |
download | perl-e1dccc0d34a90e3511bfed596be9d78128ca7ee7.tar.gz |
remove index offsetting ($[)
$[ remains as a variable. It no longer has compile-time magic.
At runtime, it always reads as zero, accepts a write of zero, but dies
on writing any other value.
Diffstat (limited to 'pod/perlvar.pod')
-rw-r--r-- | pod/perlvar.pod | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 890909d526..3217e3cc55 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -2071,25 +2071,17 @@ Removed in Perl 5.10. =item $[ X<$[> X<$ARRAY_BASE> -This variable stores the index of the first element in an array, and -of the first character in a substring. The default is 0, but you could -theoretically set it to 1 to make Perl behave more like B<awk> (or Fortran) -when subscripting and when evaluating the index() and substr() functions. - -As of release 5 of Perl, assignment to C<$[> is treated as a compiler -directive, and cannot influence the behavior of any other file. -(That's why you can only assign compile-time constants to it.) -Its use is highly discouraged. - -Prior to Perl 5.10, assignment to C<$[> could be seen from outer lexical -scopes in the same file, unlike other compile-time directives (such as -L<strict>). Using local() on it would bind its value strictly to a lexical -block. Now it is always lexically scoped. - -Mnemonic: [ begins subscripts. +C<$[> was a variable that you could use to offset the indexing of arrays +and strings. After a deprecation cycle, the feature was removed in +Perl 5.16. Two old ways of coping with the variability of the index +offset, which were rendered obsolete in Perl 5.000 when C<$[> became +effectively lexically scoped, are still supported: you can read it +(always yielding zero) and you can assign zero to it. Deprecated in Perl 5.12. +Removed in Perl 5.16. + =item $OLD_PERL_VERSION =item $] |