#!/usr/bin/perl use strict; use warnings; use Text::CSV; my $csv = Text::CSV->new ({ sep_char => '|' }); while (){ my $line = $_; chomp; next if (/Order/); print ("string $_ \n"); $_ =~ s/\"//g; my @array = split /\|/ ; print("order $array[0] , wrong sometimes $array[3]\n"); my $status = $csv->parse($line); my @columns = $csv->fields(); print("order $columns[0] , right $columns[3]\n\n"); } __DATA__ "129822"|"Custom Currency"|"Living the | Dream"|"400" "129823"|"Custom Currency"|"Living the Dream"|"500"