rokadave has asked for the wisdom of the Perl Monks concerning the following question:
I'm making a data structure and I don't want any empty keys.
This code works:
$a->{'b'}=$b if $b;
The problem is that's way too verbose... and the real code is much uglier than that.
I was wondering if there's some great shortcut operator. I got excited about ||=, but it's not really the samething. ? and : don't exactly work either. The point is to have no key 'b' exist if $b is false.
Back to
Seekers of Perl Wisdom