Anomalous, you're right. As I wrote in my original post, I have never actually used s/foo/bar other than in a one liner. I was looking for a way to find and replace strings in a file without writing to a new output file and when the replacement strings are not the same length as the sub-strings that are replaced. Clearly I am not doing this the correct way, and if there is a correct way, I haven't been able to find/understand it yet. What I want is to open a file and if a line is:
'nc7-52:p39|read1|1|19|296|0.0642'
and change it to:
C_fraterna_nc7-52
using a hash where $hash{nc7-52}=C_fraterna_nc7-52
Update: From this example it looks like it would be easy to print to output, but some lines in the file will not be modified and I still want to preserve them.
sorry, this thread may be a bit out of control since I had too many problems to begin with
In reply to Re^2: In place search and replace with a hash
by hkates
in thread In place search and replace with a hash
by hkates
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |