Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Colorize

by extremely (Priest)
on Jun 13, 2001 at 06:58 UTC ( #87994=note: print w/replies, xml ) Need Help??

in reply to Colorize

Well, not to toot my own horn too much but you could add my Web Color Spectrum Generator to yours and let it scale a color spectrum across the text. That is one of the two uses I built it for, the other being coloring table rows.

$you = new YOU;
honk() if $you->love(perl)

Replies are listed 'Best First'.
Re: Re: Colorize
by WrongWay (Pilgrim) on Jun 13, 2001 at 07:45 UTC
    I actaully looked at that, but deemed it too much for my needs.

    I am currently using this sub to colorize 1,000s of mp3 titles on a private mp3 jukebox of mine. Everytime time I generate the list(do a search) this sub gets called 1,000s of times. I wanted it to keep it light and tight so to speak. Just the basics. Get in and get out quick.

      If speed is a concern, among other things, you might move the declaration of @colors out into an enclosing block:
      { my @colors=(...); sub colorize { ... } }
      This way, @colors will still have only be 'locally' visible to colorize, but it will only be created once, at load-time, instead of every time you call colorize();.
        And be sure that's in a BEGIN block, not just a naked block, or else there's a chance that the initializer for @colors might not have run yet.


        { my @colors=(...); sub colorize { ... } }


        BEGIN { my @colors=(...); sub colorize { ... } }

        -- Randal L. Schwartz, Perl hacker
        Be sure to read my standard disclaimer if this is a reply.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://87994]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-01-22 06:35 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (232 votes). Check out past polls.