in reply to treat each result line individually in SELECT statement Perl-Mysql
If the number is really 2, and unless we're going for trivia points, I don't see the point of not just doing fetchall_arrayref and looking at the ->[-1] element. It's kinda unclear, since... do you only want to look at the 2nd element only if there are at least 2 or not? Or fall back to the last element?
But, to make things interesting, I have -- rubs hands -- what I suspect is generally secret knowledge: there is a....hidden (ok, some might say undocumented, so you should avoid it :) function in DBD::mysql: DBD::mysql::st::dataseek($sth, $pos); ($pos is 0-based). I leave it to you how to abuse it, if you dare. :)
|
---|