my $empty5 = $dbh->selectall_arrayref("SELECT count(item) FROM audio"); foreach my $row (@$empty5) { my ($count) = @$row; if ( $count > 1 ) { print "Processing $count Items\n"; &processItem; } else { print "No Items\n"; &noItems; } print "$count\n"; }