Perldoc Search: "$[" perl-5.20.1

search official POD


3 PODs, 20 LINEs found.
perldiag.pod
101 :     Assigning non-zero to $[ is no longer possible
102 :         (F) When the "array_base" feature is disabled (e.g., under "use v5.16;") the special variable $[, which is deprecated, is now a fixed zero value.
2788 :     That use of $[ is unsupported
2789 :         (F) Assignment to $[ is now strictly circumscribed, and interpreted as a compiler directive. You may say only one of
2791 :             $[ = 0;
2792 :             $[ = 1;
2794 :             local $[ = 0;
2795 :             local $[ = 1;
2798 :         This is to prevent the problem of one module changing the array base out from under another module inadvertently. See "$[" in perlvar and arybase.
3179 :     $[ used in %s (did you mean $] ?)
3180 :         (W syntax) You used $[ in a comparison, such as:
3182 :             if ($[ > 5.006) {
3186 :         You probably meant to use $] instead. $[ is the base for indexing arrays. $] is the Perl version number in decimal.
3294 :     Use of assignment to $[ is deprecated
3295 :         (D deprecated) The $[ variable (index of the first element in an array) is deprecated. See "$[" in perlvar.
perlvar.pod
1153 :     $[      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 awk (or Fortran) when subscripting and when evaluating the index() and substr() functions.
1155 :             As of release 5 of Perl, assignment to $[ 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.
1157 :             Prior to Perl v5.10.0, assignment to $[ could be seen from outer lexical scopes in the same file, unlike other compile-time directives (such as strict). Using local() on it would bind its value strictly to a lexical block. Now it is always lexically scoped.
1161 :             Under "use v5.16", or "no feature "array_base"", $[ no longer has any effect, and always contains 0. Assigning 0 to it is permitted, but any other value will produce an error.
perlport.pod
719 :     The desire of users to express filenames of the form "<Foo$Dir>.Bar" on the command line unquoted causes problems, too: `` command output capture has to perform a guessing game. It assumes that a string "<[^<>]+\$[^<>]>" is a reference to an environment variable, whereas anything else involving "<" or ">" is redirection, and generally manages to be 99% right. Of course, the problem remains that scripts cannot rely on any Unix tools being available, or that any tools found have Unix-like command line arguments.
<< Back to Perldoc Search