in reply to Array index
All the indexes of array starts with 0.How to change the start index of array to "101";
Subtract 101 from the index.
use constant BASE => 101; $a[$i - BASE] = 'a';
This will still work:
without preventing you from doingprint("The array has ", 0+@a, " elements\n"); for (@a) { ... }
for my $i (101..200) { ... $a[$i - BASE] ... }
There's also $[, but
I'd avoid it.
How to see the documentation of perl modules installed in Unix box
Update: Compensated for a warning. There needs to be space between - and BASE.
|
|---|