]> git.vpit.fr Git - perl/modules/autovivification.git/blobdiff - lib/autovivification.pm
Add a caveat about dereferencing slices
[perl/modules/autovivification.git] / lib / autovivification.pm
index 1bab02f6466839d44978531853d89c1c348125e6..ab0fc22668280726b6a1890c6f84a6afdf3b91f0 100644 (file)
@@ -151,6 +151,12 @@ sub import {
  ();
 }
 
+=head1 CAVEATS
+
+The pragma doesn't apply when one dereferences the returned value of an array or hash slice, as in C<< @array[$id]->{member} >> or C<< @hash{$key}->{member} >>.
+This syntax is valid Perl, yet it's discouraged as the slice is here useless since the dereferencing enforces scalar context.
+If warnings are turned on, Perl will complain about one-element slices.
+
 =head1 DEPENDENCIES
 
 L<perl> 5.8.