in reply to Reading file contents into an array

If you use <FILE> in an array context, you slurp the entire file into the array in one move. You do not need a while-loop around it. Effectively, the first line/name gets read by the while (<FILE>), saved into $_ and never used.

I'm not sure how the spaces around the names come about. It might have something to do with the way your file is built: are there any spaces following the names and before the EOL character(s)?

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

  • Comment on Re: Reading file contents into an array