Logo

Programming-Idioms

History of Idiom 199 > diff from v1 to v2

Edit summary for version 2 by daxim:
New Perl implementation by user [daxim]

Version 1

2019-09-28, 20:24:38

Version 2

2019-09-29, 11:47:00

Idiom #199 Truncate a file at the current file position

Truncate a file F at the give file position.

Idiom #199 Truncate a file at the current file position

Truncate a file F at the give file position.

Imports
use Path::Tiny qw(path);
Code
my $F = path('F')->openrw;
# ... read some from $F to advance
# position of file handle (not shown) ...
truncate $F, tell $F;
Doc URL
http://p3rl.org/tell