use strict; use Tie::File; tie(my @fl, 'Tie::File', 'somefile.txt') or die("ack - $!"); unshift @fl, 'a line of text here'; untie @fl;