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.


In reply to Re: pretrunkulation? by talexb
in thread pretrunkulation? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.