<p>I'm looking at the following code snippet:</p>

<pre><code>my @ret = &lt;someMethod&gt;
return (undef) if( $DB_ERROR );
return (undef) unless ($#ret &gt;= 0);
</code></pre>

<p>Does <code>$#</code> just give you a count of elements in a array?</p>

```
$#arrayname
```
gives you the index of the last element, so if array
```
@ret
```
has 2 elements then
```
$#ret
```
is 1.
And, as noted by Barry Brown, an empty array gives -1.
To get the length you can use the array in scalar context:
```
```
print scalar @ret;
```
```