Tuesday, July 28, 2009

Perl question> whats the quickest way to delete the last two characters in a file? (it needs to be quick)?

Hi, whats the quickest way to delete the last two cahracters of a file (without reading the whole thing in and spitting it out again?) . Any perl gurus out there?





thanks...

Perl question%26gt; whats the quickest way to delete the last two characters in a file? (it needs to be quick)?
my $filename = "... whatever ...";


truncate $filename, (stat($filename)-%26gt;size) - 2;


No comments:

Post a Comment