⭐ in reply to How can we read each line from a file onto an array?
my @lines = <FILE>;
But beware, as the perlfaq 5 says:
Whenever you see someone do this:
@lines = <INPUT>;You should think long and hard about why you need everything loaded at once. It's just not a scalable solution. You might also find it more fun to use the the standard DB_File module's $DB_RECNO bindings, which allow you to tie an array to a file so that accessing an element the array actually accesses the corresponding line in the file.
|
|---|