I use the following code to open a text file and update any strings such as "apple" to orange".
But now I must change any words that that have "apple" as a substring to any words that have "orange" as a substring. For example "data/applered" or "new_apple_dark" becomes " data/orangered" "new_orange_dark" and so on .open (IN,"c:\\data"); @lines = <IN>; close IN; @lines = map { s/\b$old_hostname\b/$new_hostname/sgi; $_ } @lines; open (OUT,">c:\\data") || "can't open data :$! "; print OUT @lines;
How can I alter my substitution to make it work.
--thanks kirk
In reply to String substitution by kirk123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |