in reply to What protects me from doing this stupid thing..?
You can always parenthesize defensively.
$template->param( some_var => ( $hash{some_possibly_undefined_key} || 10 ) )
...but it looks to me as if your example actually works as you intend.
The big problem I see is that you default to 10 even if you have a defined value of 0 (see also True or False? A Quick Reference Guide).
|
---|