文字列の反転はflip

Perl5までは、文字列の反転は

reverse "foo";

だったが、Perl6では

"foo".flip;
(1, 2, 3).reverse;

と使い分ける。


実際には、flipは

"foo".comb.reverse.join;

と等価であるらしい。

The flip function reverses a string character by character.

http://perlcabal.org/syn/S32/Str.html

Note that strings are now reversed with flip.

http://perlcabal.org/syn/S32/Containers.html

flip, reverse, invertをハッシュに適用してみると異なる結果になる。

flip: The flip function reverses a string character by character.
flip (scalar string op) - reverses order of characters in strings
reverse (array method) - returns all the members in the opposite order. Use "flip" to turn a string back to front and "invert" for hashes
invert (hash op & method) - inverts the key => value relation of pairs and hashes

http://www.perlfoundation.org/perl6/index.cgi?perl_6_index_tablet