in reply to Putting files in an Array
Your problem here seems to be that you're only pushing lines onto the array if they match /head/ but none of your sample lines match this. Result: empty array. Perhaps you meant !~ instead of =~.
It's difficult offering concrete advice here as your written explanantion "... put each line of a text file in an array ..." contradicts your code which is conditionally adding lines to the array. Furthermore, you'd probably get a better answer if we knew what you were planning to do with this array beyond print "@results\n";.
Maybe take a look at Tie::File. This will read all lines into an array in a single statement. The size of your file is not an issue with this module.
-- Ken
|
|---|