|
|
| "be consistent" | |
| PerlMonks |
Re: Best way to read line x from a fileby ambrus (Abbot) |
| on Mar 29, 2004 at 13:32 UTC ( [id://340700]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
As others have said, this is wasteful because it reads the whole file while it should read only the first 9 lines. If you want a solution that has no visible loop (or map etc), you could try using the module Tie::File. This module is in the standard Perl distrib. (Note that Tie::File numbers the lines with zero-offset.) Otherwise, for me seems the best solution but there might be a more elegant one.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||