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
In reply to Re: Hashes, Arrays, Comparing Values to Elements
by GrandFather
in thread Hashes, Arrays, Comparing Values to Elements
by Trihedralguy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |