Perl Bug 11 - push returning total number elements instead of number new elements


perl version: 5.6.1, 5.8.4
Operating System: Linux 2.4.18-686, Linux 2.6.7-1-k7

The return value for push is the total number of elements in the array.

According to the docs, push:

  Returns the new number of elements in the array.

Example code:

  my @j = (1..100);
  print push(@j,42), "\n";

Should display 1, but it displays 101.


The final resolution was:

The documentation of "push" has been clarified to indicate that it returns the size of the array following the push.