foreach my $record (@records) { foreach my $key (keys %$record) { print "$key:$record->{$key}"; print $q->br; } } #### foreach my $record (@records) { foreach my $key (keys %$record) { if ($record->{$key} =~ /client/) {print "this is a client"; print $q->br;} } }