Have an idea?

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

Return string based on identifier

Respondents will be tracked through the login page where they enter a unique identifier.  I want to show them different text  based on the first two characters of their identifier. I've set it up like this:

[% Begin Unverified Perl
    return "a";
    return "b";
End Unverified %]

However, in testing it only appears to show "a", regardless of if I enter "aa" or "bb" as the identifier. Any help would be appreciated, let me know if I need to clarify further.
asked Nov 21 by Matthew

1 Answer

+1 vote
Try changing your "==" to "eq", as this is the operator to use when comparing text / strings.

And use "ne" for not equal.
answered Nov 21 by Paul Moon Platinum (100,815 points)
Thank you! That did the trick. I am (obviously) still learning Perl.
And learn you will Matthew. You just picked up on a small lesson here, and I'm sure there's more lessons down the track. Keep asking the questions my friend. A great way to learn.