in reply to How to access hash value based on user defined condition.

DBI does that for you.
Consider doing:
my $sgv = $dbh->prepare("show variables"); $sgv->execute(); my $href = $sgv->fetchall_hashref('Variable_name'); my $var_to_print = 'back_log'; print $$href{$var_to_print}{'Value'};

--
olus