in reply to Conditional statements in CGI/Div
Two possible (untested) options:
Or, use the ternary form:use CGI qw/:standard *div/; my $cgi = new CGI; print $cgi->header(), $cgi->start_html(), $cgi->start_div({-id=>pagewrap}); # NOTICE ** START_DIV if($index==0) { print $cgi->p("Hello"); } print $cgi->end_div(), $cgi->end_html();
use CGI ":standard"; my $cgi = new CGI; print $cgi->header(), $cgi->start_html(), $cgi->div({-id=>pagewrap}, $index==0 ? $cgi->p("Hello") : "" ), $cgi->end_html();
Most people believe that if it ain't broke, don't fix it.
Engineers believe that if it ain't broke, it doesn't have enough features yet.
|
---|
In Section
Seekers of Perl Wisdom