As below Perl script shows, it seems $_
is not passed as default parameter to reverse in list context. Why doesn't it just accept $_ as default parameter and do the scalar to list conversion? What's the rule for function's default parameters in both context?
I saw this post, which mentioned @_
should be the default parameter for function which operates in list mode (list reverse, sort), but it doesn't seem to be that case after I prepend @_ = somelist
to the below code snippet.
$_ = "dlrow ,olleH";
print reverse; # No output, list context
print scalar reverse; # Hello, world