It depends on how you are building your HTML page. Are you just using strings or are you using some templating system? My guess would be for the latter, but you'll have to tell us which one.
And that's assuming you want this code to be executed on server side, not client side (ie: the color doesn't change after the page is loaded).
Edit: relying on the return value of if/else isn't very good style IMHO. But you can use the ternary operator instead which works like that: CONDITION ? VALUE_IF_TRUE : VALUE_IF_FALSE;, so in your case: my $bgcolor = ($ref->{'status'} == 'open') ? 'blue' : 'red'
In reply to Re: Conditional statement in HTML code.
by Eily
in thread Conditional statement in HTML code.
by techjohnny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |