[18:25][nick:~/monks]$ cat 1135741.pl #! perl -w use strict; use feature qw/ say /; use Path::Tiny qw/ path /; my $file = 'test.dat'; my @lines = path( $file )->lines( { chomp => 1 } ); # do something with @lines ... my @append = (); # empty array path( $file )->append( @append, { truncate => 1 } ); say "Done."; __END__