On Tue, 27 Jan 2004, Trina Espinoza wrote:

> So this may be wishful thinking, but I would be kicking myself later if I didn't 
> ask. Is there a function in perl where you give
> the function  exact line numbers and it would only read the data in the range of 
> lines you gave it? My other alternative would be
> using a counter to find a start line and an end line in a file. Doable but painful. 
> Let me know if there is any hope . . . 


Possibly you are thinking of using an array ?

@lines=<FILE>;
$Line_Wanted=$lines[Wanted_File_Number];

That means you put the file in an array, then read an array element, that  
being the line number you want. Remember arrays start at 0;

If you have very large files, you might have to use another strategy.

You might also whant to look at the $. variable


Owen



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to