if ($foo eq "true") { ...
This does what I want. If $foo is "true", it runs. If it's anything else, or not set at all, it doesn't. But -w throws warnings at me if $foo isn't defined. To satisfy it, I have to do this instead:
if ($foo && $foo eq "true") { ...
The first check will short-circuit if it fails, so the warning doesn't get thrown. But it seems like I'm making my ifs unnecessarily complex. Is there a better/prettier way?
---
A fair fight is a sign of poor planning.
In reply to When warnings get in the way by Sprad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |