in reply to Subroutines within if statements

And the B::Deparse module can be handy when trying to figure out why when something's not behaving the way you expect. I show running over code given in a shell here-doc, but you can do the same thing to code in a file via perl -MO=Deparse,-p my_file.plx.

$ perl -MO=Deparse,-p <<'EOT' if ($answer eq "add" || "a") { &addlinks; } elsif ($answer eq "remove" || "r") { &rmlinks; } else {exit 0; } EOT if ((($answer eq 'add') or 'a')) { &addlinks; } elsif ((($answer eq 'remove') or 'r')) { &rmlinks; } else { exit(0); } - syntax OK

In the explicitly parenthesized version you can see exactly what your comparisons really mean to Perl.

The cake is a lie.
The cake is a lie.
The cake is a lie.