<?xml version="1.0" encoding="windows-1252"?>
<node id="1009789" title="Re: Warning is right or not ?" created="2012-12-20 15:14:05" updated="2012-12-20 15:14:05">
<type id="11">
note</type>
<author id="634253">
AnomalousMonk</author>
<data>
<field name="doctext">
&lt;p&gt;
The function &lt;c&gt; get_IATA() &lt;/C&gt; defined in the OP returns either a &lt;i&gt;two&lt;/I&gt; element list if the condition &lt;c&gt; $data eq $airline &lt;/C&gt; is ever true, or &lt;strike&gt;the pre-post-incremented value of &lt;c&gt; $count &lt;/C&gt;&lt;/STRIKE&gt;&lt;u&gt;false&lt;/U&gt; otherwise. (BTW: Is the latter behavior really intended?) The effects of assigning a multi-element list in scalar versus list context are shown in the code example below. Is the behavior in the scalar assignment below similar to the unspecified failure mentioned in the OP? If so, the proper cure is to return only a single scalar (perhaps the hash value with a concatenated newline) and assign in scalar context, i.e., to &lt;c&gt; $hash{'AirIATA'} &lt;/C&gt; and not to a slice.
&lt;/P&gt;

&lt;c&gt;
&gt;perl -wMstrict -MData::Dump -le
"my %hash;
 ;;
 $hash{'AirIATA'} = get_IATA();
 dd \%hash;
 ;;
 @hash{'AirIATA'} = get_IATA();
 dd \%hash;
 ;;
 sub get_IATA { return 'useful', 'unexpected'; }
"
Scalar value @hash{'AirIATA'} better written as $hash{'AirIATA'} at ...
{ AirIATA =&gt; "unexpected" }

{ AirIATA =&gt; "useful" }
&lt;/C&gt;
</field>
<field name="root_node">
1009773</field>
<field name="parent_node">
1009773</field>
</data>
</node>
