in reply to What eats up less resources?

They key thing here is "It keeps growing all the time". Doing it line by line will be far slower, but will probably tax the system less overall. If you don't know how big this thing will get, the system could take a major RAM hit loading it into an array. Personally I only load files into an array when I can be sure that they are small (like config files), or I'm at home being lazy on my own machine.

In some other notes, if you load it into an array, just chomp the whole array like ' chomp(@db) '. I'm also fairly sure that chop would be faster than chomp (by maybe a cycle or two), and if you're sure that there is a newline as a separator chop is pretty safe.