in reply to Nesting SELECT statements

You're coding your SQL the wrong way. This isn't an answer to your question (gjb already handled that) but a barb your buggy SQL coding style.

Quit it with the SELECT * and then fetching into an array. Either specify your column names explicitly like SELECT countryid, languageid, slid, title and fetch to an array OR continue to use SELECT * but fetch to a hash instead. You've got to break the implied link between column order in your RDBMS table and your perl code. Your current style just makes things harder than they need to be.

There's a wonderful example in the DBI documentation - I'll include it just because it's so pretty

$sth->execute; my %row; $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } )); while ($sth->fetch) { # And now the same hash is re-used for every iteration. print "$row{region}: $row{sales}\n"; }

Seeking Green geeks in Minnesota