<?xml version="1.0" encoding="windows-1252"?>
<node id="1003929" title="Re: Fix-it fix-it fix-it!" created="2012-11-14 23:52:44" updated="2012-11-14 23:52:44">
<type id="11">
note</type>
<author id="540414">
jwkrahn</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;&lt;c&gt;
print "What is the name of the access rights .csv? (Full file name)\n";
my $file = &lt;&gt;;
&lt;/c&gt;&lt;/i&gt;&lt;/blockquote&gt;
&lt;p&gt;
That would be better written as:
&lt;/p&gt;
&lt;c&gt;
print "What is the name of the access rights .csv? (Full file name)\n";
chomp( my $file = &lt;STDIN&gt; );
&lt;/c&gt;&lt;br /&gt;&lt;br /&gt;


&lt;blockquote&gt;&lt;i&gt;&lt;c&gt;
print "Is there a header in this file?\n";
my $header = &lt;&gt;;
if ($header =~ m/^yes|^y]/i){
	$header = "1";
}
else {$header = "undef";
}
&lt;/c&gt;&lt;/i&gt;&lt;/blockquote&gt;
&lt;p&gt;
At this point &lt;c&gt;$header&lt;/c&gt; will &lt;b&gt;ALWAYS&lt;/b&gt; be true. &amp;nbsp;&amp;nbsp; I think you meant &lt;c&gt;$header = undef;&lt;/c&gt; instead of &lt;c&gt;$header = "undef";&lt;/c&gt;.
&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;



&lt;blockquote&gt;&lt;i&gt;&lt;c&gt;
open (CSV, "&lt;", $file);
&lt;/c&gt;&lt;/i&gt;&lt;/blockquote&gt;
&lt;p&gt;
You should always verify that the file opened correctly before trying to use an invalid filehandle.
&lt;/p&gt;
&lt;c&gt;
open CSV, '&lt;', $file or die "Cannot open '$file' because: $!";
&lt;/c&gt;
</field>
<field name="root_node">
1003880</field>
<field name="parent_node">
1003880</field>
</data>
</node>
