I can see plenty of true cases which are not covered by the || 0 part to return 0 on false ...
DB<6> $rx->{"ping_$i"} = "abc" DB<7> p delete $rx->{"ping_$i"} || 0 abc # not numeric DB<8> p "" || 0 0 # was false DB<9> p undef || 0 0 # was false DB<10> p " " || 0 # " " is true DB<11> p "abc" || 0 abc DB<12> p int "abc" 0 # not numeric evaluates t +o 0 tho in numeric context DB<13> p int "7abc" 7 # beware that leading cip +hers are accepted tho DB<14> use warnings; say int "7abc" Argument "7abc" isn't numeric in int at ... # but will thro a warning + too ... DB<15> p int "" # the || 0 part is redund +ant in all false cases 0 DB<16> p int " " # sic 0 DB<17> p int undef # sic 0 DB<18>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re: Argument spamming terminal
by LanX
in thread Argument spamming terminal
by CougarXR7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |