Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: (jeffa) 2Re: Simplicity vs. Doing It Right

by BrowserUk (Patriarch)
on Oct 13, 2002 at 21:50 UTC ( [id://204942]=note: print w/replies, xml ) Need Help??


in reply to (jeffa) 2Re: Simplicity vs. Doing It Right
in thread Simplicity vs. Doing It Right

In my defense, I was trying to be a little more CGI.pm about it and adopt the 'poetry mode'. With another hour of giggling I finally cracked what I was so close to before.

This produces the same out put as my original above and uses but a single print statement, in deference to all those post I've seen saying "You don't want all them print statements, use CGI.pm" ;^).

Whether this is better or worse than my original or yours I'll leave it to the reader to make their own conclusions.

#! perl -sw use strict; use CGI qw/:standard *table/; use CGI::pretty; sub Dlighken { return sprintf '%02x'x3, map{ ($_ *= 1+$_[1]) > 0xff ? 0xff : $_ } map hex, unpack 'A2'x3, $_[0]; } my @colors = qw/800000 808000 008000 008080 000080 808080 c0c0c0/; print table( Tr( th(' '), th([@colors]) ), map{ my $scale = $_/10; Tr( td($_), map{ td({bgcolor=>"$_"},[$_]) } map{ Dlighken($_, $scale) } @colors ) }( -5 .. +5 ) ) ; __END__

Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-29 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found