in reply to reverse function
As the documentation for reverse explains, using it in scalar context does string reversal, not list reversal.
Thus it joins all arguments into a string and reverses it.
If you want the other output, either leave off the scalar, or write
print join '', reverse(1, 'ab'));
Note that this behavior confuses many newcomers (though usually they wonder why print reverse "abc"; doesn't reverse anything) and is inconsistent with how things are generally done elsewhere in Perl 5, so in Perl 6 reverse always reverses lists, and flip always reverses strings.
|
---|
In Section
Seekers of Perl Wisdom