Mino,
Something like this should probably work:
$var(x) = "1,2,3,4";
$var(i) = 0;
while(defined $(var(x){s.select,$var(i),,})) { ...
$var(i) = $var(i) + 1; }
If the 'defined' operator always results 'true' on the results of this transformation, then alternately this:
while($(var(x){s.select,$var(i),,}{s.len}) > 0)
-- Alex