in reply to switching characters

How about just using Text::CSV_PP itself to determine where the headings row is?
... open $fh ... $csv = Text::CSV_PP->new(); # create a new CSV parser object $csv->sep_char('|'); # look for the header line my $line = 0; my $col; while ($line < 20 && defined($col = $csv->getline($fh) )) { if ($csv->[0] eq '#') { # found it break; } $line++; } unless ($line < 20 && defined($col)) { die "header line not found\n"; } # process the rest of the file while (defined($col = $csv->getline($fh))) { ... }

Replies are listed 'Best First'.
Re^2: switching characters
by kevind0718 (Scribe) on Jan 11, 2008 at 20:54 UTC
    Actually I now see the issue.
    What the regular expression to match the beginning of a string.?
    I do belive $row =~ m/#/; is true for the first row. kd
      you'll want to use m/^#/ to match a # at the beginning of the line.
        thanks

        kd