Keep in mind that the "Use of uninitialized..." message is only a warning. Strictly speaking you don't have to fix it but naturally it's best to do so.
The way I commonly fix this is to do:
if ($variable and $variable eq 'value') {
# do something
# ...
}
This uses the "short circuit" property of and to check whether the variable is defined before it checks the value. I'm sure some of the more experienced monks can enlighten us as to whether or not this is good practice.
--
Grant me the wisdom to shut my mouth when I don't know what I'm talking about. |