use strict; use warnings; my $tmpfile = 'f.tmp'; # test file used only for testing this script standalone my @names; open my $fh1, "<:encoding(utf-8)", $tmpfile or die "$tmpfile: $!"; while (<$fh1>) { chomp; push @names, $_; } close $fh1;