2006/10/19

Tricky substitute


$original = "lib p($library)";
$original =~ s/$library/mylibrary/;
print "$original\n";

$original did not change at all, because $library is variable and it is undef in our case, so you cannot find the undef string in $orinial to change it to new string. What we can do is

$original =~ s/\$library/mylibrary/;

No comments:

Post a Comment