Okay, this is probably not what you intend. This takes $new, and sets it equal to $comment. Then this is treated as a list (of 1 item), which is assigned to $_ in the for loop (the s// will by default work on $_), and then $comment is set equal to the result of doit().$comment = "My lawyer is named will"; for ($new = $comment) { $comment = &doit($comment); }
This sets $go equal to that string.sub doit{ $go = ";gie/moT/lliw/s ;gie/reknaB/reywal/s ;gie/yenraB/derf/s";
This sets $com equal to the result of this.$com = join("", reverse split(//, $go));
which is then returned ($new being set equal to that).return $com; } print $new;
It seems you want to _run_ those searches against $new. You'll want an eval() statement to do that. (Why is left to your own twisted goals). I suggest you study the for() loop because I suspect you are misunderstanding what it is doing.
Update: eval() can be a security risk if you are running anything that can be affected by user input, particularly on a web page. I suggest you use perl's taint mode, and CGI.pm
In reply to Re: newkid confused
by swiftone
in thread newkid confused: reverse then unreverse a string
by caciqueman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |