in reply to Reading file contents into an array

You probably want:
my @names = <FILE>; chomp @names;
The while loop is not needed.