Zachary has pointed out a few Perl issues you have which are spot on.
When I have these problems, I use something like this ...
[%Begin Unverified Perl
This will return the value of the first brand from the BrandSelect1 list. I assume this list populates all brands>0 from Q2 and randomises them.
Pop this Perl script into the question where you want it displayed.
Just tested it and it works nicely.