<?xml version="1.0" encoding="windows-1252"?>
<node id="853722" title="Re^4: File Reading and Closing confusion" created="2010-08-08 23:49:22" updated="2010-08-08 23:49:22">
<type id="11">
note</type>
<author id="665462">
repellent</author>
<data>
<field name="doctext">
I was referring to &lt;i&gt;being wary&lt;/i&gt; when &lt;c&gt;$line=&lt;FH&gt;&lt;/c&gt; is used on its own. To illustrate:&lt;br&gt;
&lt;c&gt;
$ perl -e 'print "with_ending\nno_ending"' &gt; a.txt
$ perl -MData::Dumper
    open(FH, "&lt;", "a.txt") or die $!;
    my $line1 = &lt;FH&gt;;
    my $line2 = &lt;FH&gt;;
    my $line3 = &lt;FH&gt;;
    close FH;

    $Data::Dumper::Useqq = 1;
    print Dumper [$line1, $line2, $line3];
__END__
$VAR1 = [
          "with_ending\n",
          "no_end",
          undef
        ];
&lt;/c&gt;
&lt;br&gt;
We see that there is a possibility that a line read (&lt;c&gt;$line3&lt;/c&gt; in this case) may return &lt;c&gt;undef&lt;/c&gt;. That's what I meant: we need to be wary that a line read will not always return defined.&lt;br&gt;
</field>
<field name="root_node">
853652</field>
<field name="parent_node">
853691</field>
</data>
</node>
