Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

How to create a hidden variable from a checkbox question using Unverified Perl

I'm trying to create a race variable for quota purposes based on a question called S4 which is multiple-choice, but the code is not working. I get an error 132.
This is the code I'm using in a free format hidden variable:

<input name="Race_code" id="Race_code" type="hidden" value="

[%Begin Unverified Perl
my $Race_grp=0;

if ((VALUE("S4_1")==1) && (VALUE("S4_2")==0) && (VALUE("S4_3")==0) && (VALUE("S4_4")==0)&& (VALUE("S4_5")==0)&& (VALUE("S4_6")==0))
 {
  $Race_grp=1;
 }
 elseif 
 ((VALUE("S4_1")==0) && (VALUE("S4_2")==1) && (VALUE("S4_3")==0) && (VALUE("S4_4")==0) && (VALUE("S4_5")==0) && (VALUE("S4_6")==0))
 {
  $Race_grp=5;
 }
 return $Race_grp;
End Unverified %]
 ">

What is wrong with this code? Can somebody help? Thanks!
asked Aug 28, 2020 by rinsights Bronze (740 points)
132 is a generic error that shows up when something went wrong running unverified Perl.  You can get more information about what happened from the admin module.

Glancing over your script, you'll need to replace "elseif" with "elsif".

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.
...