[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : : foreach my $keyer (@keysarray) { : if ($condorhash{$keyer} eq "FINISHED" ) {delete $condorhash{$keyer}};
: if ($condorhash{$keyer} eq "STARTED") {$condorhash{$keyer} = "font({-color=>'green'}STARTED)"}; : if ($condorhash{$keyer} eq "VACATING") {$condorhash{$keyer} = "font({-color=>'red'}VACATING)"}; : if ($condorhash{$keyer} eq "QUEUED") {$condorhash{$keyer} = "font({-color=>'dark blue'}QUEUED)"}; : } : : It doesn't work and I am not completely sure why. I think I : am missing something small here but I am not sure what. Please help! You don't say what you mean by "doesn't work" so we can only guess. Assuming that 'font' is an imported function from CGI.pm and that STARTED, VACATING, and QUEUED are not constants: $condorhash{$keyer} = font( { color => 'green' }, 'STARTED' ) if $condorhash{$keyer} eq 'STARTED'; $condorhash{$keyer} = font( { color => 'red' }, 'VACATING' ) if $condorhash{$keyer} eq 'VACATING'; $condorhash{$keyer} = font( { color => 'navy' }, 'QUEUED' ) if $condorhash{$keyer} eq 'QUEUED'; A more flexible method would be to use CSS and classes. It will also avoid the usually deprecated <font> tag. With CSS you or someone else can change colors without opening the hood on your script. in the imported CSS file: /* server states white = #ffffff maroon = #800000 black = #000000 navy = #000080 aqua = #00ffff olive = #808000 blue = #0000ff purple = #800080 fuchsia = #ff00ff red = #ff0000 gray = #808080 silver = #c0c0c0 green = #008000 teal = #008080 lime = #00ff00 yellow = #ffff00 */ .started { color: green; } .vacating { color: red; } .queued { color: navy; } In the foreach: $condorhash{$keyer} = span( { class => 'started' }, 'STARTED' ) if $condorhash{$keyer} eq 'STARTED'; $condorhash{$keyer} = span( { class => 'vacating' }, 'VACATING') if $condorhash{$keyer} eq 'VACATING'; $condorhash{$keyer} = span( { class => 'queued' }, 'QUEUED' ) if $condorhash{$keyer} eq 'QUEUED'; You could also take advantage of the aliasing in foreach to shorten your statements: delete @condorhash{ grep $condorhash{$_} eq 'FINISHED', keys %condorhash }; foreach my $state ( values %condorhash ) { if ( $state eq 'STARTED' ) { $state = span( { class => 'started' }, 'STARTED' ); } elsif ( $state eq 'VACATING' ) { $state = span( { class => 'vacating' }, 'VACATING' ); } elsif ( $state eq 'QUEUED' ) { $state = span( { class => 'queued' }, 'QUEUED' ); } } Or, if it you think it is legible: # delete FINISHED states delete @condorhash{ grep $condorhash{$_} eq 'FINISHED', keys %condorhash }; # "classify" STARTED, VACATING, and QUEUED states $_ = span( { class => lc $_ }, $_ ) foreach grep $_ =~ /^(?:STARTED|VACATING|QUEUED)$/, values %condorhash; HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]