我有一个更新RSS提要的Perl子例程.我想测试返回的值,但是函数在很多地方使用,所以我只想测试默认变量$_,据我所知,如果没有指定变量,应该为指定的返回值.
sub updateFeed { #.... if($error) { return 0; } return 1; }
为什么呢
$rtn = updateFeed("My message"); if ($rtn < 1) { &Log("updateFeed Failed with error $rtn"); }
不记录任何错误
而
updateFeed("myMessage"); if ($_ < 1) { &Log("updateFeed Failed with error $_"); }
记录错误“updateFeed失败错误”? (注意消息末尾没有值.)
谁能告诉我为什么默认变量似乎包含空字符串或undef?