Alan Campbell schreef:

> The first 4 lines are gobbldygook and need to be skipped. Currently
> I'm doing... 
>     while (my $line = <TRACECSV>) {
>         next unless ($. > 4);      # only do work if on > 4th line
> 
> but on a 10000 line file thats 9996 wasted operations.

#!/usr/bin/perl
  use strict;
  use warnings;

  my $fname = 'data.csv';
  open my $TRACECSV, '<', $fname or die "Error opening '$fname': $!";

  <$TRACECSV> while $. <= 4;
  while (my $line = <$TRACECSV>) {
     # ...
  }

(untested)

-- 
Affijn, Ruud

"Gewoon is een tijger."

-- 
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