use strict; use warnings; use IO::File; my $fh = IO::File->new; $fh->open($file, O_RDWR) or die $!; $fh->print... $fh->seek... $fh->truncate... $fh->close;