Help for this page

Select Code to Download


  1. or download this
     open my $fh, "<:encoding(utf8)", "test.csv" or die "test.csv: $!";
     while ( my $row = $csv->getline( $fh ) ) {
         $row->[2] =~ m/pattern/ or next; # 3rd field should match
         push @rows, $row;
     }
    
  2. or download this
    ...
     while (my $line = <CSV>) {
        chomp $line;
            if ($csv->parse($line)) {
    ...
    
  3. or download this
    open my $CSV, '<:encoding(utf8)', $file or die "Cannot open $file: $!\
    +n"