in reply to Hashes, Arrays, Comparing Values to Elements

We don't have access to your database and are not likely to mock up your web site to test out the code. It makes it much easier for us (and for your own testing) if you mock up just enough context to test the code you are having trouble with. The following may point you in the right direction:

use strict; use warnings; use strict; my @inColors = ( ['blue', 'foo'], ['red', 'bar'], ['blue', 'baz'], ); my %colors; for my $inColor (@inColors) { if (exists $colors{$inColor->[0]}) { print "Replacing $inColor->[0], $colors{$inColor->[0]} with $i +nColor->[1]\n"; } else { print "Adding $inColor->[0], $inColor->[1]\n"; } $colors{$inColor->[0]} = $inColor->[1]; }

Prints:

Adding blue, foo Adding red, bar Replacing blue, foo with baz

Perl's payment curve coincides with its learning curve.

Replies are listed 'Best First'.
Re^2: Hashes, Arrays, Comparing Values to Elements
by Trihedralguy (Pilgrim) on Nov 30, 2008 at 05:10 UTC
    Its all done, but this is a new revision that I want to figure out, hopefully to make the response time of the grid faster. Here is current what is running, the code for it is posted above. http://pixelated.hertzelle.com/draw.pl