>>>>> "ab" == a b <testa...@gmail.com> writes:
ab> Hey Thanks all! ab> I got it ;) ab> open (FH, "+< $fname")|| die "\nFailed to open file $fname\n"; you don't need to open the file at all. truncate can take a filename. ab> my $tmp=$fsize-$trunccount; where do those get set? don't name vars $tmp as that tells the reader nothing about the variable's use. ab> seek(FH,$tmp,0); ab> $addr = tell(FH) ; you don't need the seek and tell calls. you have the size you want and you can pass that directly to truncate. ab> truncate(FH, $addr)|| die "\nFailed to truncate $file: $!"; ab> close(fd); ab> print "\nTruncate successful\n"; this can all be reduced to this: my $size = -s $file ; truncate( $file, $size - $truncount ) || die "\nFailed to truncate $file: $!"; uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/