Irfan Sayed wrote:
hi,

Hello,


i have following code.


$target = "abc,xyz";
print "$target\n";
$target =~ s/,/\s/g;
print "$target\n";

i need to replace "comma" with whitespace for string "abc,xyz"

"Whitespace" is something that applies only to regular expressions but the second part of the substitution operator is just a string, not a regular expression. And which of the five whitespace characters should this string interpolate "\s" as: " ", "\r", "n", "t" or "\f"?


the output shud be "abc xyz"


the above regular expression does not do that . please suggest

$target =~ tr/,/ /;



John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction.                   -- Albert Einstein

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to