Nkuipers wrote:

>>e.g. I have a file with a header - and I only need the data from line
>>100 and forward where the single lines are put in to a array for further
>>"treatment".
> 
> If you are SURE of consistent formedness in your input file (data will
> always be at lines 100+) you could use the $. var, which holds the current
> line number in a file:
> 
> open FH, "< yourfile" or die $!;
> while (<FH>) {
> next until $. = 100;

should probably be "$. == 100" but this is a bit better:

last if($. > 100);

because you don't care anything after 100 lines, why not simply get out of 
the loop instead of wasting time doing 'next' and compare?

aslo, if your file is small,  you can also:

my @array = (<FH>)[0..100];

but that's kind of bad :-)

david

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to