in reply to fetchrow_hashref returns blanks

It's hard to say why this is happening from your code, which is using the correct syntax. Debug with the always useful Data::Dumper
use Data::Dumper; while (my $data = $sth->fetchrow_hashref) { print Dumper($data); }
Your hashref may not contain exactly what you think it does.