@array = reverse;
and
@array = reverse $_;
Both are different. @array = reverse doesn’t use $_ implicitly. We have to declare $_ explicitly. It’s a very strange case where $_ is not being used by default. Is it a bug?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
As far as I understand from the reverse documentation,
reverseworks on arrays, and so it should use@_rather than the scalar$_?The documentation says “Used without arguments in scalar context,
reverse()reverses$_.” [Emphasis added]