I ran into a bug tonight using &#39;map&#39; which taught me something about map and raised a further question:<br><br>   my ($fee, $fi, $fo) =<br>       map {$fropper ? $fropper-&gt;$_ : $glopper-&gt;$_}<br>           qw/fee fi fo/;<br>

<br>The bug arises bc fropper and glopper are not guaranteed to have return values for fee/fi/fo, and bc map evaluates BLOCK in LIST context. So if fee or fi is undefined, you get an empty list which collapses in the final result. Then fi or fo can get assigned to the wrong variable.<br>

<br>Here&#39;s my question, I can prevent it this way (by ORing with an empty string):<br><br>   my ($fee, $fi, $fo) =<br>       map {$fropper ? $fropper-&gt;$_ || &#39;&#39; : $glopper-&gt;$_ || &#39;&#39;}<br>           qw/fee fi fo/;<br>

<br>But that&#39;s ugly -- is there a cleaner way to avoid this problem?<br><br><br clear="all"><br>-- <br>==========================<br>2People citizen&#39;s network for climate action: <a href="http://www.2people.org">http://www.2people.org</a><br>

<br>Greater Seattle Climate Dialogues: <a href="http://www.climatedialogues.org">http://www.climatedialogues.org</a><br>The Great Warming coalition<br>==========================<br>