Hi all,
I have a script that slurps in some files, does stuff to them, and writes them out again using a standard slurping idiom (yes I know it is generally better to read in a line at a time, that is not the point of the post):
sub EditFile{
my $file = shift;
open INFILE,$file;
my $text = do{local $/;<INFILE>};
close INFILE;
# edit text
open OUTFILE,">$file";
print OUTFILE $text;
close OUTFILE;
}
My problem is that some of these files have a "^Z" or "^A" character in the middle of them. When I slurp these files, the slurp stops at the "^Z" or the "^A", and I lose half the file. How do I get around this?
Thanks!