in reply to Reading and writing back an updated string

mgwump:

Perhaps you should try writing perl code instead of whatever that is.

$ perl -c tmpx.pl "my" variable $var masks earlier declaration in same statement at tmpx +.pl line 5. Global symbol "$fh" requires explicit package name (did you forget to +declare "my $fh"?) at tmpx.pl line 1. Global symbol "$fh3" requires explicit package name (did you forget to + declare "my $fh3"?) at tmpx.pl line 2. syntax error at tmpx.pl line 2, near "$fh3 for " Global symbol "$fh" requires explicit package name (did you forget to +declare "my $fh"?) at tmpx.pl line 4. Can't redeclare "my" in "my" at tmpx.pl line 6, near "my" Global symbol "$var" requires explicit package name (did you forget to + declare "my $var"?) at tmpx.pl line 6. syntax error at tmpx.pl line 7, near ") }" Global symbol "$fh" requires explicit package name (did you forget to +declare "my $fh"?) at tmpx.pl line 9. Global symbol "$fh" requires explicit package name (did you forget to +declare "my $fh"?) at tmpx.pl line 10. Unmatched right curly bracket at tmpx.pl line 10, at end of line tmpx.pl has too many errors.

...roboticus

When your only tool is a hammer, all problems look like your thumb.