Ok, I have <> and $^I down pat for inplace file edit where files are passed on the command line. Is there a neat way of doing the same for <filehandle> rather than something like this:
my $SomeFile = "delme.txt"; open inFile, "<$SomeFile" or die "Can't open $SomeFile for input: $!"; open outFile, ">~$SomeFile" or die "Can't open ~$SomeFile for output: +$!"; print outFile while <inFile>; close inFile; close outFile; unlink "$SomeFile.bak"; rename $SomeFile, "$SomeFile.bak"; rename "~$SomeFile", $SomeFile;
In reply to Inplace file edit mark II by GrandFather
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |