![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
Hi, I have written a sub called str_replace. This sub is supposed to work the same as the php function str_replace. Heres the code: sub str_replace { my( $find,$replace,$what ) = @_; $what =~ s/$find/$replace/i; return $what; } I then use this function to find x and replace it with y in z like so: $string = str_replace("Hi", "Hello", "Hello My Name Is Elfyn"); This function only returns 'Hi' instead of 'Hi My name Is Elfyn'. Any help on why fellow monks. Cheers, Elfyn
|
|