perl中用warn进行调试

来源:互联网 时间:1970-01-01

perl中可以用warn进行调试,如果有错误,可以打印出相关信息,如:

printf "%.2f/n",pide(3,4);
printf "%.2f/n",pide(1,0);
printf "%.2f/n",pide(5,4);

sub pide{
 my( $numerator,$denominator )=@_;
 warn "N: [numerator] D: [denominator]";
 
 return $numerator / $denominator;
}


相关阅读:
Top