caciqueman has asked for the wisdom of the Perl Monks concerning the following question:
But when I try to reverse the string or array, the results dont work on the first string, even if I call in inside a sub.....#!/usr/bin/perl print "Content-type: text/html\n\n"; ......This Works................... $comment = "My lawyer is named will"; for ($new_comment = $comment) { s/lawyer/Banker/eig; s/will/Barney/eig; s/is/Was/eig; } print $new_comment;
Yes, it is stupid to want to do this, but I need to. Could anyone please tell me how I might accomplish this. Thanks........Why Doesnt This Work ? ................ $comment = "My lawyer is named will"; for ($new = $comment) { $comment = &doit($comment); } sub doit{ $go = ";gie/moT/lliw/s ;gie/reknaB/reywal/s ;gie/yenraB/derf/s"; $com = join("", reverse split(//, $go)); return $com; } print $new;
Edit kudra, 2002-04-15 Changed title
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: newkid confused
by swiftone (Curate) on Apr 05, 2002 at 21:46 UTC | |
by swiftone (Curate) on Apr 05, 2002 at 22:07 UTC | |
by caciqueman (Novice) on Apr 05, 2002 at 22:52 UTC | |
by tadman (Prior) on Apr 05, 2002 at 23:55 UTC | |
by belg4mit (Prior) on Apr 06, 2002 at 00:19 UTC | |
|
Re: newkid confused
by Zaxo (Archbishop) on Apr 05, 2002 at 21:53 UTC | |
by Chady (Priest) on Apr 06, 2002 at 17:43 UTC | |
by swiftone (Curate) on Apr 07, 2002 at 17:09 UTC |