perl中可以用warn进行调试,如果有错误,可以打印出相关信息,如:
printf "%.2f\n",divide(3,4);
printf "%.2f\n",divide(1,0);
printf "%.2f\n",divide(5,4);
sub divide{
my( $numerator,$denominator )=@_;
warn "N: [numerator] D: [denominator]";
return $numerator / $denominator;
}