perlquestion
live4tech
<p>I recently came upon the following line of code:</p>
<code>
$FH = $OUTFH{$name} ||= IO::File->new(">g:\\perl_scripts\\$name.log") or die $!;
</code>
<p>I have looked for the ||= operator and found it only in a table in perlop. There is no description of it or examples using it. I have not found it anywhere else. </p>
<p>From the context of the above code line and through some testing I found that the line works like this:
$FH will be set to $OUTFH{$name} if $OUTFH{$name} is defined. If $OUTFH{$name} is undefined, $FH is set to the IO::File reference.</p>
<p>Is this the same as //? This is really poorly documented...</p>
<p></p>
<p></p>