No doubt please, I know about regular expressions and Python/Ruby support them fully. I only showed the approach of method calling. There could be not "replace" method.

William M West wrote:

Python and Ruby don't write the code for me. But look at this Python

code:

s = "I am Perl guru";
new_s = s.replace("Perl", "Python");



i always had trouble doing this in perl- just worked around it- then realized that this shouldn't be hard when reading your post... so i played...

$s = "I am Perl guru";

$new_s = ($s =~ s/erl/ython/);

print "$s \t $new_s \n";  #oops!  Prints      I am a Python guru
1"

#but....

($new_s = $s) =~ s/erl/ython/;
print "$s \t $new_s \n";


#prints   I am a Perl guru      I am a Python guru


Perl can be surprisingly intuitive- using precedence rules to get this done makes good sense to me :)





Huh? Remark, no addition modules.



*shrug* eh- go figure



willy
http://www.hackswell.com/corenth

-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to