Trying to concatenate in perl for dynamic text display

Earlier, I infer city/state from zip code. I ask a question to confirm do you live in [city, state].
If they say no I ask them to type in their city name (LOC1_r1_c1) and then select their state from a dropdown (loc_r1_c2).

The goal is to display the following:
If we got the correct information (CorrectCity=2) then I display the city/state deduced. This works.
If we got the incorrect information then I want to concatenate the typed in city and the state from the dropdown with a ', ' in between so it reads 'City, State'.

I am unable to get the concatenate portion to work. Everything else works, but the concat just shows either nothing or '1' depending on how i try to configure things.


[% Begin Unverified Perl
#setting string for concatenation
my $tempcity = GETVALUE("LOC1_r1_c1");
my $tempstate = LISTLABEL("STATEList", GETVALUE("LOC1_r1_c2"));
my $newloc = $tempcity . ', ' . $tempstate;

#Condition for displayed text
if (GETVALUE("CITYCORRELATION") == 2)
{
print $newloc;
}
elsif (GETVALUE("CorrectCity") == 2)
{
return LISTLABEL("CITYSTATEList", GETVALUE("CITYSTATE"));
}

End Unverified %]

Resolved
4 replies