Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This whole sub is really confusing, and I'm a fairly regular perl user. Here are some blanket suggestions.</p> <ul> <li>Do not create your own <code>undef</code> ever -- use <code>undef</code> then return at the bottom <code>return $var // 'NULL'</code>.</li> <li>Do not ever do this: <code>foreach $row</code>, because <code>foreach my $row</code> is less prone to create problems. Localizing variables is good.</li> <li>Do not needlessly concatenate, for it offends the style god: not this, <code>print "\nReturning: " . $thiskey . "\n";</code>, but <code>print "\nReturning: $thiskey\n";</code>, or if you don't need the first <code>\n</code>: <code>say "Returning: $thiskey;"</code> (5.10 only)</li> <li><code>grep</code>ing over <code>0 .. $#array;</code> is categorically lame, just grep over the array: <code>grep {} @{$foo[0]}</code>, and with that code being so complex you almost certainly don't want <code>grep</code> (though I don't understand what you're doing to be honest.). Check out <code>perldoc -q first</code> -- in short <em>grep doesn't stop until the end</em>.</li> </ul> <p>Lastly, do not assign an array to a scalar: <code>$thiskey = @result;</code> is an implicit <code>$thiskey = scalar @result;</code> (see <code>perldoc -q scalar</code>) for more info. What you probably want is to return the array reference. Something like this (which eliminates <code>$thiskey</code>)</p> <pre><code>printf "\nReturning: %s\n", join ', ', @result; @result ? \@result : 'NULL'; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload