Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Conditional statements in CGI/Div

by Your Mother (Chancellor)
on Jan 27, 2013 at 23:31 UTC ( #1015597=note: print w/ replies, xml ) Need Help??


in reply to Conditional statements in CGI/Div

Your style is all over the place and to do in such a sort space is something of an achievement. :P Please use strict and pick a CGI style. You are importing a ton of functions (":standard") but using it object oriented. There is almost never a reason to use it OOP in a standalone script; only if you need to pass it around libraries or harnesses.

You can't just drop a post-fix conditional into a print list. You can use the Enterprise operator (see Secret Perl Operators: the boolean list squash operator, x!!), among a couple other tricks though–

use strict; use CGI ":standard"; my $index = param("index") || 0; print header(), start_html(), div({ -id => "pagewrap" }, ( p("Hello") ) x ! $index, ), end_html();


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://1015597]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (9)
As of 2015-07-28 10: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 (254 votes), past polls