in reply to why the value of count will be change?

Because Perl does call by reference

The elements in @_ are aliases, you should copy them first.

From perlglossary

A nickname for something, which behaves in all ways as though you’d used the original name instead of the nickname. Temporary aliases are implicitly created in the loop variable for foreach loops, in the $_ variable for map or grep operators, in $a and $b during sort’s comparison function, and in each element of @_ for the actual arguments of a subroutine call. Permanent aliases are explicitly created in packages by importingsymbols or by assignment to typeglobs. Lexically scoped aliases for package variables are explicitly created by the our declaration.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

PS: And for god's sake, please use indentation!

  • Comment on Re: why the value of count will be change?

Replies are listed 'Best First'.
Re^2: why the value of count will be change?
by yueli711 (Sexton) on May 09, 2018 at 00:06 UTC

    Thank you so much! My question is why the value of count is just the number of the data in @? Thank you in advance!