Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: reverse a string in place

by mtve (Deacon)
on Mar 27, 2013 at 12:07 UTC ( [id://1025692]=note: print w/replies, xml ) Need Help??


in reply to reverse a string in place

hmm, regular expression, without using any other array or (almost no) build-in functions:

#! /usr/bin/perl use warnings; use strict; $_ = 'abcdefghi'; # s/./ substr $_, -$+[0], 1 /eg; # duh, substr and array # s#.# /(.).{$-[0]}$/; $1 #eg; # duh, array my $x = 0; s#.# /(.).{$x}$/; $x++; $1 #eg; print "$_\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1025692]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-19 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found