Nothing wrong with 'reverse', its acting exactly as specified.

'reverse' changes the order of a list. A string is considered a single entity in perl(6), unlike other languages where a string is an array of characters.

So in order to get 'reverse' to work on a string, it first needs to be turned into a list. There is a useful method to do just that - 'comb'.

The aim of 'comb' is to extract what is specified from a string, which defaults to a list of all its characters. Hence what you want is

my $str='abcde';
say $str.comb.reverse; # edcba

Regards

On 06/18/2010 09:25 AM, Xi Yang wrote:
I'm using rakudo 2010_05, with parrot 2.4.0. I found the $str.reverse just 
don't work at all:
$ perl6 -e 'my $str="abcde"; say $str; say $str.reverse;'abcdeabcde             
                      
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969

Reply via email to