#!perl
# Dumper demo cgi
use strict;
use Data::Dumper;
print "Content-Type: text/html\n\n";
print '<pre>';
my $ref = [ { ID => 'ABC'},{ ID => 'DEF'},{ ID => 'GHI'} ];
print '<h2>$ref</h2>';
print Dumper $ref;
print '<hr/>';
my @array = map { $_->{ID} } @$ref;
print '<h2>@array</h2>';
print Dumper @array;
print '<hr/>';
my @error = @array."\n";
print '<h2>@error</h2>';
print Dumper @error;
print '<hr/>';
Also, note how map could be used to replace this code in search_item()
my @array = @$resultsRef
foreach my $hit (@array) {
# $hit is a hash reference.
my %hash = %$hit;
push @searched, $hash{ID};
}
poj |