in reply to replacing part of a string
Hm, think about it this way:
open my $FILE, '<', $name_of_file_with_functions_in_it or die ("Crap: +$!"); while (<$FILE>) { s/\bC\b/$z/g; # replace the *word* "C" with the contents of $z print $_; } close $FILE;
This prints the output to STDOUT
If you want to replace 'C' with the literal string '$z', then you just have to escape the $ in the above (\$z).
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: replacing part of a string
by Anonymous Monk on May 14, 2009 at 04:28 UTC |