http://www.perlmonks.org?node_id=1013222


in reply to Conditional statements in CGI/Div

Here's what you need:

$cgi->div({-id=>pagewrap}, ($index==0 ? $cgi->p("Hello") : $cgi->p() ) }
or something long those lines.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg

Replies are listed 'Best First'.
Re^2: Conditional statements in CGI/Div
by slurch901 (Initiate) on Jan 27, 2013 at 23:18 UTC
    Thanks everyone for your input but the only way I could solve it was instead of using the DIV statement with brackets was to use the alternative.
    print $cgi->start_div({-id=>pagewrap}); if($index==0) {print "Hello";} print $cgi->end_div();