my $seek_loc = (-s FILE) - $bytes; $seek_loc = 0 if $seek_loc < 0; seek(FILE, $seek_loc, 0);