This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add note about the handling of negative indices to tied arrays
[perl5.git] / pod / perltie.pod
index 95de3bb..49bf989 100644 (file)
@@ -260,6 +260,10 @@ index whose value we're trying to fetch.
       return $self->{ARRAY}[$idx];
     }
 
+If a negative array index is used to read from an array, the index 
+will be translated to a positive one internally by calling FETCHSIZE
+before being passed to FETCH. 
 As you may have noticed, the name of the FETCH method (et al.) is the same
 for all accesses, even though the constructors differ in names (TIESCALAR
 vs TIEARRAY).  While in theory you could have the same class servicing
@@ -281,6 +285,8 @@ there.  For example:
       }
       return $self->{ARRAY}[$idx] = $value;
     }
+Negative indexes are treated the same as with FETCH.  
 
 =item DESTROY this