(defined($coin) && $coin == 25) || warn("You must insert 25 cents"), return 0;
Should be either
(defined($coin) && $coin == 25) or warn("You must insert 25 cents"), return 0;
or
(defined($coin) && $coin == 25) || (warn("You must insert 25 cents"), return 0);
Otherwise it will always return. I personally always use or for these kinds of idioms, as it is more likely to have the precedence I want.
In reply to Re: Being more Assert-ive with Perl
by itub
in thread Being more Assert-ive with Perl
by stvn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |