Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!

by Anonymous Monk
on Sep 03, 2005 at 09:46 UTC ( #488890=note: print w/replies, xml ) Need Help??


in reply to Re: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!
in thread “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!

--> What is the index of the first element of an array in Perl?

0

Actually,
$[ The index of the first element in an array, and of the fir +st character in a substring. Default is 0, but you could theoretically set it to 1 to make Perl behave more like aw +k (or Fortran) when subscripting and when evaluating the index() + and substr() functions. (Mnemonic: [ begins subscripts.) As of release 5 of Perl, assignment to $[ is treated as a compiler directive, and cannot influence the behavior of a +ny other file. (That's why you can only assign compile-time constants to it.) Its use is highly discouraged. Note that, unlike other compile-time directives (such as strict), assignment to $[ can be seen from outer lexical s +copes in the same file. However, you can use local() on it to st +rictly bound its value to a lexical block.
  • Comment on Re^2: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!
  • Download Code

Replies are listed 'Best First'.
Re^3: “A meeting at the Liquor-Vodka Factory”, or… same ARRAY questions again?!!
by ikegami (Patriarch) on Sep 03, 2005 at 16:54 UTC
    Shoot, you're right. I consider $[ deprecated, so I never think of it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://488890]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2023-01-29 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?