You probably want to do something like this:
sub ProcessFile
{
my ( $FileName ) = @_;
# Open file for reading and writing, slurp entire file into an arra
+y.
open ( HTML, "+<$FileName" )
or die "Cannot open $FileName for read/write: $!";
my @Line = <HTML>;
# Seek to the beginning of the file and truncate the file, ready to
# write the updated information back in.
seek ( HTML, 0, 0 );
truncate ( HTML, 0 );
# Go through the file, deleting zero height and width restriction o
+n IMG
# tag, then write corrected line out to the file.
my $Count = 0;
foreach ( @Line )
{
$Count += s/\r//;
print HTML $_ or die "Unable to output to $FileName: $!";
}
print " $Count";
# Close the file.
close ( HTML );
}
I can't advise you strongly enough to forget about modifying the OS' internal file system to achieve the same objevtive. Surely that way madness lies.
And don't assume you'll never need this under anything than Linux. Perl makes it simple to write portable code -- why mess with that?
ps Apologies for the mis-match between comments and code -- I had to write a bunch of these filters quickly.
pps Yes, I could have used tr/// instead of s/// there. I said I was in a rush.
--t. alex
"Of course, you realize that this means war." -- Bugs Bunny.
|