Logo

Programming-Idioms

History of Idiom 41 > diff from v53 to v54

Edit summary for version 54 by programming-idioms.org:
[Perl] Wrong impl

Version 53

2019-09-27, 08:24:19

Version 54

2019-09-27, 08:28:08

Idiom #41 Reverse a string

Create string t containing the same characters as string s, in reverse order.
Original string s must remain unaltered. Each character must be handled correctly regardless its number of bytes in memory.

Illustration

Idiom #41 Reverse a string

Create string t containing the same characters as string s, in reverse order.
Original string s must remain unaltered. Each character must be handled correctly regardless its number of bytes in memory.

Illustration
Code
my $t = scalar reverse $s;
Code
my $t = scalar reverse $s;
Comments bubble
**DOESN'T WORK WITH MULTI-BYTE CHARACTERS**

This snippet will be deleted soon