in reply to Re: Getting numeric value of a alphabetic string
in thread Getting numeric value of an alphabetic string

Thanks a lot for the message. Its a bit unclear to me as how can I use this information in my case. I have about 7000 unique identifiers and I need 7000 unique colors for that. Thanks Nagesh
  • Comment on Re^2: Getting numeric value of a alphabetic string

Replies are listed 'Best First'.
Re^3: Getting numeric value of a alphabetic string
by anonymized user 468275 (Curate) on Aug 05, 2005 at 07:51 UTC
    There are 753 unique colours in the openwin rgb.txt on the machine nearest my thumb and the following code indexes them by unique name into a hash of hash :
    #!/usr/bin/perl use Data::Dumper; open RGB, '</usr/openwin/lib/rgb.txt'; my %rgb = (); while ( <RGB> ) { if ( /^(\d+)\s*(\d+)\s*(\d+)\s*(.*)$/ ) { $rgb{ $4 }{ red } = $1; $rgb{ $4 }{ green } = $2; $rgb{ $4 }{ blue } = $3; } } print Dumper( \%rgb );
    output: