Did you try to complile it (
perl -c filename.pl)? Probably you should fix syntax errors before going to the next stage.
- in the SELECT row, you should call the prepare statement and close the parenthesis;
- checking the error results from the calls would be fine;
- did you successfully initiated the connection towards the database, i.e. is $dbh valid?
Regarding your particular question, the last part of your code prints out the selected data: you can use
$array_ref wherever you need it, as long as this variable doesn't go out of scope. So, the way you're accessing the data seems correct to me.
As a terminating node, I've been hand-slapped yesterday for using a one-word title in a post: don't do that, and the admins will be happy. Suggested readings: How do I compose an effective node title? and Writeup Formatting Tips (your post lacks code tags).
Flavio (perl -e "print(scalar(reverse('ti.xittelop@oivalf')))")
Don't fool yourself.