$data = (); $sql = sprintf $sql_fmt, $account->[$i]{ 'ACCOUNT#' }; $data = exec_select( $sql ); foreach (@$data) { ....