Melly has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monkees,
What's the best way to read a particular line from a file? e.g. I want to perform a regex against line 10 of a file, but I don't want/need to read in the whole file.
works, but I'm not sure how efficient this is. I could run a loop, but that would look messy, and if I want, say, line 5000, it would be inefficient (IMHO).my $line2 = (<FILE>)[9];
Any advice?
Tom Melly, tom@tomandlu.co.uk
Back to
Seekers of Perl Wisdom