For my program, I’m attempting to replace the value of a specific hash in an external file with a newly created value. The external file has the value tab-delimited from the key, and I had read the hash in from the external file. I’ve been looking around online, and this is the closest way I could figure out how to do it, yet it doesn’t seem to work.
open(IN, '>>$file') || die 'can't read file $file'; while (<IN>) { print IN s/$hash{$key}/$newvalue/; } close (IN)
I’m not quite sure what I’m missing in this formula.
Tie::File can fix this for you.