... my $csv = Text::CSV_XS->new(); open (CSV, "<", $file_to_parse) or die "Could not open '$file' $!
"; while (my $line = ) { chomp $line; if ($csv->parse($line)) { my @columns = $csv->fields(); #check user file format been uploaded TEST: perl -le 'print "1234567" =~ /^[[:alnum:]]+$/ ? "OK" : "BAD"' if( ($columns[0]!~/^[[:alnum:]]+$/) && ($columns[2]!~/^[[:alnum:]]+$/) ) { # wrong format exit; }else{ my $err = $csv->error_input; print "
Failed to parse line, please call for help!
"; } } ...