use strict; use warnings; open my $fh, ">", "testing1.txt"; print $fh "stat"; seek $fh, 0, 0; print $fh "stat-updated"; close $fh; system cat => "testing1.txt";