Have an idea?

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

syntax error at (eval 139) line 5, near "Perl my " Global symbol "$i" requires explicit

OK this is doing my head in.  What am I not seeing?  This is throwing the "requires explicit" error.  I know someone will point it out and I'll feel like an idiot but been staring at it too long.


Begin Unverified Perl

my $i = 0;
my $j = 0;

for($i = 3; $i <= 21; $i++)
{
    $j = $i + 21;
    
    if(GETVALUE("Q5_r".$i."_c1") == 1)
    {
        ADD("aaaCardList",$i);
    }

    if(GETVALUE("Q5_r".$i."_c2") == 1)
    {
        ADD("aaaCardList",$j);
    }
}

End Unverified

asked Aug 9, 2019 by Marion Bronze (3,770 points)
Couldn't see any obvious issues with this? Syntax looks fine. Looking forward  to a response myself.

Does this work in the meantime?
Begin Unverified Perl
 
my $i = 0;
 
for($i = 3; $i <= 21; $i++)
{
    if(GETVALUE("Q5_r".$i."_c1") == 1)
    {
        ADD("aaaCardList",$i);
    }
 
    if(GETVALUE("Q5_r".$i."_c2") == 1)
    {
        ADD("aaaCardList",$i+21);
    }
}
 
End Unverified
I'm not seeing anything stand out either.  I tried using the code myself, but didn't see an error.  Give Paul's code a try and keep us posted if the issue persists.
Am glad I wasn't going crazy either?

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.
...