In Perl, the s/ operator is used to replace parts of a string. Now s/ will change its parameter (string) in place. I would, however, replace parts of the line before printing, as in
print "bla: ", replace("a","b",$myvar),"\n";
Is there such a replace function in Perl or some other way to do this? s/ will not work directly in this case, and I would like to avoid using an auxiliary variable. Is there any way to do this online?
sleske
source share