in reply to Dynamically marking a HTML select option as selected

How's this:

$html .= qq[<select name="foo">]; for ('option1:One', 'option2:Two') { my ($val, $desc) = split /:/; my $sel = ($val eq $existing_value) ? ' selected' : ''; $html .= qq[<option value="$val"$sel>$desc]; } $html .= qq[</select>];

    -- Chip Salzenberg, Free-Floating Agent of Chaos