in reply to csv parsing with multiple missing values/multiple commas
Several errors here, some of which would be detected by the compiler using strictures and warnings. First:if($str_check = undef){do stuff};{return ('0');}else{return($str_check +);}
should be something like this:if($str_check = undef) ...
Next, do stuff is incorrect syntax, but I assume you've put there as a summary instead of your real code. The problem though is that it would be good to have the real code. Anyway, when you have:if (! defined $str_check) ...
The conditional stops at the semi-colon, so that your function will always return '0' and the else branch will never be executed. Maybe you want something like this:if($str_check = undef){do_stuff()};
return $str_check if defined $str_check; return '0';
|
|---|