Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Conditional statements in CGI/Div

by NetWallah (Abbot)
on Jan 13, 2013 at 22:24 UTC ( #1013137=note: print w/ replies, xml ) Need Help??


in reply to Conditional statements in CGI/Div

Two possible (untested) options:

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();
Or, use the ternary form:
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.


Comment on Re: Conditional statements in CGI/Div
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013137]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-07-04 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls