... my $dir_txt_files = "stuff/"; tie my @array, 'Tie::File', $dir_text_files or die "Could not open file '$dir_text_files' $!"; unshift @array, 'NAME, ADDRESS, ZIPCODE' unless $array[0] =~ /^[a-zA-Z]/; # Remove any blank lines. @array = grep /\S/, @array; untie @array; ....