use FileHandle; $fh = new FileHandle "< nodes.lis"; @nodes = <$fh>; undef $fh; # automatically closes the file