Nihil Angst has asked for the wisdom of the Perl Monks concerning the following question:
require TripodCGI; $CGI=new TripodCGI; $firstName=$CGI->param('firstName'); $Age=$CGI->param('Age'); print "Content-type: text/html\n\n"; print "<HTML><TITLE>Conditionals test</TITLE> </HEAD><BODY>"; if ($Age < 13) && ($Age > 0)) { print "What are you doing here, $firstName? This Web site is strictly PG-13. Shame on you for being so naughty as to come here!"; } elsif ($Age < 18) && ($Age > 12)) { print "Not to long ago, we’d have have chased you away from our Web site. But now that you’re a teenager and mature enough for PG-13 materials, we’re glad to see you $firstName."; } elsif ($Age < 30) && ($Age > 17)) { print "If you’re viewing this Web site on your work computer, you should be aware that the materials presented on this Web site are, in their own way, as inflammatory as pornography. You could get in a lot of trouble, $firstName."; } elsif ($Age < 40) && ($Age > 29)) { print "Congratulations, $firstName, you’re on longer a callow youth. Never trust anyone under 30; that’s what we say!"; } elsif ($Age < 60) && ($Age > 39)) { print "You’re getting on in years, $firstName. It’s time to start thinking about establishing retirement savings."; } else { print "So you’re still dirt poor, $firstName? Oh well, guess you always will be. Those are the breaks, oldster."; } print "</BODY></HTML>";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A newbie's first try at conditionals
by DamnDirtyApe (Curate) on Aug 17, 2002 at 01:53 UTC | |
|
Re: A newbie's first try at conditionals
by Zaxo (Archbishop) on Aug 17, 2002 at 01:58 UTC | |
|
Re: A newbie's first try at conditionals
by Maclir (Curate) on Aug 17, 2002 at 03:30 UTC | |
|
Re: A newbie's first try at conditionals
by jlongino (Parson) on Aug 17, 2002 at 17:11 UTC |