I couldn't get throught to your site but check this out:
#!/usr/bin/perl -Tw use strict; use CGI qw(:standard -no_xhtml -newstyle_urls); # (C) 2001, Jaldhar Vyas # Licensed under the Crowley Public License ('Do what thou wilt # shall be the whole of the license.') # Declare our color sets as a hash of references to arrays. my %colorsets = ( patriotic => ['red', 'white', 'blue'], sensitive => ['aqua', 'silver', 'teal'], fugly => ['maroon', 'fuchsia', 'lime'], ); # pick the color set from the query string, making sure it actually # exists in case someone sent us random crap. Default is # 'patriotic'. Use the trinary operator because it is so cool. my $colors =(param('scheme') && exists($colorsets{param('scheme')})) ? $colorsets{param('scheme')} : $colorsets{patriotic}; # print the page. print header, start_html(-title => 'color sets', -author => 'jaldhar@braincells.com'), p('The current scheme is ', param('scheme') || 'patriotic', '.'), table({border => 2}, Tr( # for each cell we pick a random color from our chosen color set. # Remember, $colors is a reference to an array so dereference # accordingly. This ought to be a subroutine to avoid repetition. td({bgcolor => @$colors[rand scalar @$colors], width => 100}, ' '), td({bgcolor => @$colors[rand scalar @$colors], width => 100}, ' '), td({bgcolor => @$colors[rand scalar @$colors], width => 100}, ' '), ), ), p('Select a color scheme:'), # A form to pick color sets from. start_form, radio_group(-name => 'scheme', -values => ['patriotic', 'sensitive', 'fugly'], ), br, submit, end_form end_html;
In reply to Re: How can I specify which array to use with $ENV(queary_string)?
by jaldhar
in thread [untitled node, ID 130617]
by Samn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |