Reverse a string: Difference between revisions
→Perl: ext. doc. for reverse() + fix code
(→{{header|PHP}}: unicode alternative method) |
(→Perl: ext. doc. for reverse() + fix code) |
||
Line 3,271:
=={{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;
binmode STDOUT, ":utf8";
# to reverse characters (code points):
print scalar reverse('visor'), "\n";
# to reverse graphemes:
|