use Types::Standard -types; my $row_type = Tuple[ Str, Str, Int, Bool, Optional[Num] ]; my $row_check = $row_type->compiled_check; while (my $row = $csv->get_line($fh)) { $row_check->($row) or die $row_type->get_message($row); }