Friday, May 08, 2009

Cool replace string without regex in perl

my $str = "C:\\app\\myapp\\backup\\db\\now_working";
print "\nstr = $str";
$replace_this = "myapp";
$with_this = "yourapp";
$str =~ s/\Q$replace_this\E/$with_this/;
print "\nstr = $str";

0 comments: