CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
reverse a string without using reverse fun

 



jonny
New User

Nov 5, 2007, 4:58 AM

Post #1 of 3 (2580 views)
reverse a string without using reverse fun Can't Post

How to reverese a string without using reverse function?

How to reverese a string without using any perl functions?


KevinR
Veteran


Nov 5, 2007, 10:43 AM

Post #2 of 3 (2578 views)
Re: [jonny] reverse a string without using reverse fun [In reply to] Can't Post

Perl can't do anything if you don't use a function.

To reverse a string without using the reverse function you can use split() and join().
-------------------------------------------------


rgkrishnas
Novice

Nov 6, 2007, 8:20 AM

Post #3 of 3 (2574 views)
Re: [jonny] reverse a string without using reverse fun [In reply to] Can't Post

Hi,

You could try in this way using regular expression

$a = "Hello world";

while($a =~/(.)/g){

$a_r = "$1$a_r";

}

print "$a_r\n";



 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives