Variable handing multiple values returned by query

In the variable section of grafana…
I am having query which returns let’s say

now i want to save/hold these values under variable let’s say temp
so i need output like
temp1= 6
temp2= 5
temp3= 4
temp4= 3
temp5= 2
temp6= 1

Can you please help me to achieve this…
it will be good if it can be achieved thru regex expression.

What data source are you using? What is the usecase? With a bit more details I may be able to help.

Datasource - Influx db
Use case - Their is a query which returns last 5 buildnumber and i want to hold these build number in variables as illustrated above - so that i can use it to built my charts and comparison.

Let me know if you need any other details.

@srclosson - Could you please reply.