Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: reverse a string in place

by choroba (Chancellor)
on Mar 24, 2013 at 08:57 UTC ( #1025132=note: print w/replies, xml ) Need Help??


in reply to reverse a string in place

Using substr and length:
my $s = "abcdefgh"; print "$s\n"; $s .= substr $s, length($s) - 2 * $_, 1 for 1 .. length($s) - 1;# Add +the reversed string. substr $s, 0, length($s) / 2, q(); # Remo +ve the original string. print "$s\n";
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025132]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (12)
As of 2017-02-22 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (329 votes). Check out past polls.