Reverse a string: Difference between revisions

Content added Content deleted
(→‎{{header|PHP}}: unicode alternative method)
(→‎Perl: ext. doc. for reverse() + fix code)
Line 3,271: Line 3,271:


=={{header|Perl}}==
=={{header|Perl}}==

[https://perldoc.perl.org/functions/reverse reverse()] works in the context of a List or a scalar, not a string.

<syntaxhighlight lang="perl">use utf8;
<syntaxhighlight lang="perl">use utf8;
binmode STDOUT, ":utf8";
binmode STDOUT, ":utf8";


# to reverse characters (code points):
# to reverse characters (code points):
print reverse('visor'), "\n";
print scalar reverse('visor'), "\n";


# to reverse graphemes:
# to reverse graphemes: