in reply to References Looping

In addition to the great replies above, I'll offer another tidbit. If you aren't sure that your array holds meaningful (defined) information or that it holds unique information (and assuming it needs to), here's something else to try. Not so easy on the eyes, but fun.
my @unique = keys %{ { map {$_ => 1} grep defined, @{ $config->{bids}{itemcode} } } };
Then when you take scalar @unique you know that the count represents real values found and only their unique appearance. Drop the keys enclosing block and the map block if you just want to count plain old defined elements of the "itemcode" array.