title: Perl DBI::fetchrow_array() gives empty instead of undef for NULL
body: <p>After migrating to a new server, upon executing a SELECT query, if a requested column value is <strong>NULL</strong>, Perl's <code>DBI::fetchrow_array()</code> returns what appears to be an empty string: <code>defined()</code> returns 1 and <code>length()</code> returns 0.</p>
  
  <p>Everything I read tells me that I should be getting <strong>undef</strong> from a <strong>NULL</strong>, and indeed this is the way it works on my old server.  The new server has a copy of the MySQL database which I migrated using the <em>Export SQL</em> and <em>Import SQL</em> features of <em>Sequel Pro</em>, a MySQL gui which I run on my Mac.  For both databases, the values in question are clearly indicated as gray <em>NULL</em> in Sequel Pro, and as NULL if I run <code>mysql</code> interactively.  For example, see <code>name</code> in this transcript:</p>
  
  <pre><code>mysql&gt; SELECT * from trials WHERE id = 26069 ;
  +-------+----------+-----------+---------+--------+ ...
  | id    | language | numTrials | name    | status | ...
  +-------+----------+-----------+---------+--------+ ...
  | 26069 | en       |         3 | NULL    | Done   | ...
  +-------+----------+-----------+---------+--------+ ...
  1 row in set (0.00 sec)
  </code></pre>
  
  <p>My old server is running older packages:</p>
  
  <ul>
  <li>Perl        5.10.1 vs. 5.22.1</li>
  <li>DBI         1.634 vs. 1.636</li>
  <li>DBD::mysql  4.022 vs. 4.033</li>
  </ul>
  
  <p>Here is my code around <code>fetchrow_array</code>:</p>
  
  <pre><code>@result = $statementHandle-&gt;fetchrow_array ;
  
  for my $value (@result) {
      if (! utf8::is_utf8($value)) {
          utf8::decode($value) ;
  
          # Log values for debugging the NULL/undef issue:
          my $aValue = $value ;
          my $len = length($aValue) ;
          if (!defined($value)) {
              $aValue = "&lt;unnndefined&gt;" ;
          }
          print {*::STDLOG} info =&gt; "daValue l=$len : $daValue\n" ;
      }
  }
  </code></pre>
  
  <p>Big thanks to anyone who can suggest what might be going on here!</p>