use Type::Params qw(compile); use Types::XSD qw(String Decimal Date Integer); use Text::CSV_XS; use Data::Dumper; my $validator = compile( Integer, Decimal[totalDigits => 8, fractionDigits => 3], String[maxLength => 5], Date->plus_coercions( Integer[totalDigits => 8], q{ substr($_, 0, 4)."-".substr($_, 4, 2)."-".substr($_, 6, 2) } ), String[maxLength => 8], Decimal[totalDigits => 17, fractionDigits => 3], ); my $csv = 'Text::CSV_XS'->new({ sep_char => '|' }); while (my $row = $csv->getline(\*DATA)) { my @fields = $validator->(@$row); print Dumper \@fields; } __DATA__ 12|11.00|BILL|20130131|asd123q|1234.45 14|12.0|MONKEY|20120228|gkhkg|1.2