Using two variables in Perl to build constructed list

I'm trying to build a constructed list based on the answers to two separate single-select questions. Both single-select questions have the same answer choices (same parent list). The goal of the constructed list is to produce a range of answer choices from the parent list so the starting value of the constructed list will be the answer to single-select question 1 and the end value will be the answer to single-select question 2. Does anyone know of an easy way to do this? Thanks in advance!

Just to give an idea of what I'm trying to do, my current, incorrect Perl script is this (I tried to define a new variable 'x' to be the answer to single-select question 2):

Begin Unverified Perl

my ($i,$x)=(1,2);

for(($i,$x)=1; ($i,$x)<=13; $i++;)
{
if (VALUE("B1a")==$i && VALUE("B1b")==$x)
{
ADD("B1aList",$i,$x);
}
}

End Unverified

Resolved
2 replies