use strict; use warnings; use Tie::File; tie my @array, 'Tie::File', 'file.txt' or die $!; unshift @array, 'new first line'; untie @array;