>> 
> MBNA, eh?  (japhy checks the credit card bills he 
> receives...) ;)  I guess
> it'd be in my best interest (no pun intended) to help you, then.

LOL !!! Actually I am a independent contractor, so I don't really work here
:-)

> 
> Uri Guttman wrote File::ReadBackwards, available on CPAN, 
> that can help
> you emulate tail(1).

Cool. I found a win32 Tail binary ported from GNU, but I rather stay away
from that route if I could. 

> 
> To emulate head(1), just read the first X lines of the file you want.
> 
> DO NOT PUT THE FILE INTO AN ARRAY. 

That is exactly what I was trying to avoid. So Just simply print the first
10 lines (records)? 

> That is evil, as far as 
> memory usage
> and efficiency go.  (So it's evil, in general.)

I agree.

> 
>   use File::ReadBackwards;
> 
>   open HEAD, "< $file" or die "can't read $file: $!";
>   for (1 .. 5) {
>     push @head, scalar <HEAD>;  # first 5 lines
>   }
>   close HEAD;

Ok, that is what I had in mind, just making sure there were not some better
ideas out there. This should work.

> 
>   tie *TAIL, 'File::ReadBackwards', $file or die "can't read 
> $file: $!";
>   for (1 .. 5) {
>     unshift @tail, scalar <TAIL>;  # last 5 lines
>   }
>   untie *TAIL;
> 
> Notice how I unshift()ed to @tail -- this is so that the last 
> 5 lines are
> stored in normal order in the array.

cool. Is the docs for this module available at CPAN ?

Thanks again.
If this works I will ZERO out your balance on your card .. :-)

JIm




>
> 

Reply via email to