Greetings fellow monks,
Is there a reasonably simple (i.e. no outside modules) and inexpensive way to simulate UNIX's "tail" in core Perl? Here's my situation: I've got a text file that I know over time is going to get really large. I'd like to be able to cheaply and quickly grab the last 10 (or some other specific number) of lines from the file. Obviously, I could just read in the file or just while through it until I get to the end, but I'm looking for something a little nicer.
Part Two: If finding a tail-like solution is fairly easy, the next step is to say, "Give me lines 1034 through 1047 of the file." Again, the easy solution would be just to parse through the file or something. But I'm looking for something cheaper.
Thanks in advance. Also, I'm cool with accepting that there is no solution without modules or lots of code, but I'm just hopefull... :)
-Gryphon.
In reply to Simulating UNIX's "tail" in core Perl by gryphon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |