Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm using the following code to try and remove them:^@^@^@^@ #at the end
This isn't working...Can anyone tell me why?open my $fh, "+<$Conf[1]" || die "ERROR: Unable to open $Conf[1]\: $!\n"; # Set it to binary mode for Win32 files binmode $fh; my $size = 4096; seek $fh, -$size, 2; # Locate the end of the file while (1) { $cur_pos = tell $fh; read $fh, $buf, $size; last if $buf =~ m/\s+/s; seek $fh, -$size*2, 1; } $buf =~ m/(\s*)$/s; $cur_pos += $-[0] || 0; truncate $fh, ++$cur_pos if $cur_pos; close $fh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I mark the end of a file?
by BrowserUk (Patriarch) on Apr 04, 2003 at 19:20 UTC | |
|
(jeffa) Re: How do I mark the end of a file?
by jeffa (Bishop) on Apr 04, 2003 at 19:53 UTC | |
|
Re: How do I mark the end of a file?
by hardburn (Abbot) on Apr 04, 2003 at 18:45 UTC |