in reply to Take the Arc Challenge
And they say perl is obfuscated!!! I liked almost every other example in that thread far better, what good does concise do if you have to learn a whole knew language to read it? I don't program Python or Ruby but the examples in those languages should make sense to any programmer. Below is my perl code, i think its easier to read, easier to expand, and easier to understand than the arc example. The only thing is it isn't shorter! Should I re-write it in a compact form like his? That seems insane.
#!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Session; my $cgi = new CGI; my $session = new CGI::Session(); print $session->header(); $session->param('name', $cgi->param('name')) if ($cgi->param("name")); $session->clear('name') if ($cgi->param("c")); if ($cgi->param("m") eq 'show') { print "You said:", $session->param("name"), " ", $cgi->a({href +=>'?c=1'},'Start Over'); } elsif ($session->param("name")) { print $cgi->a({href=>'?m=show'},'See what you said'); } else { print $cgi->startform, $cgi->textfield('name'), $cgi->submit(' +Submit'), $cgi->endform; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Take the Arc Challenge
by Joost (Canon) on Feb 05, 2008 at 11:36 UTC | |
by eric256 (Parson) on Feb 05, 2008 at 16:03 UTC | |
by Joost (Canon) on Feb 05, 2008 at 19:43 UTC |