sub _get_row { my @row; my $q_sep = quotemeta($self->{sep}); my $match_sep = qr/\G$q_sep/; my $start_field = qr/\G(")|([^"$q_sep]*)/; # This loop is the heart of the engine while ($line =~ /$start_field/g) { if ($1) { push @row, _get_quoted(); } else { # *** ALWAYS FALLS HERE *** push @row, $2; } my $pos = pos($line); # *** THIS ENTIRE IF BLOCK IS NEVER EXECUTED *** if ($line !~ /$match_sep/g) { if ($pos == length($line)) { return @row; } else { my $expected = "Expected '$self->{sep}'"; confess("$expected at $self->{filename}, line $., char $pos"); } } } confess("I have no idea how parsing $self->{filename} left me here!"); }