
Tie::OffsetArray - Tie one array to another, with index offset

use Tie::OffsetArray; tie @a, 'Tie::OffsetArray', 1, \@b; # offset=1; use given array. tie @c, 'Tie::OffsetArray', 2; # use anonymous array. $a[0] = 'x'; # assign to $b[1]; tied(@a)->array->[0] = 'y'; # assign to $b[0].

When tied to this class, an array's behavior is completely normal. For its internal storage, it uses another array, either one supplied by the caller, or a new anonymous one. Accesses to the tied array are mapped down to the storage array by offsetting the index by some constant amount.
A special method on the tied object returns a reference to the storage array, so that the elements below the offset can be accessed. This is particularly useful if the storage array was not supplied by the caller.

jdporter@min.net (John Porter)

This is free software. This software may be modified and distributed under the same terms as Perl itself.