#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent=0;
# Master-Array
my $master = [
{ x => ['1','a'], y => [], z => ['4'], },
{ x => ['b','a'], y => ['1','a'], z => ['1'], },
{ x => ['1','a'], y => [], z => [1], },
{ x => [], y => ['a','1'], z => ['2'], },
];
# autonome Hashes
my $h1 = { x => ['1','a'] , y => [] , z => ['4'] };
my $h2 = { x => ['a'] , y => [] , z => ['1'] };
my $h3 = { x => ['1'] , y => ['a',1] , z => [2] };
my $h4 = { x => [] , y => ['a1'] , z => ['1','2'] };
my @checkit = ($h1,$h2,$h3,$h4);
my $hrefCount;
foreach my $href (@checkit){
$hrefCount++;
masterElemente($href);
printf "ende von hrefCount: %s\n",$hrefCount;
};
sub masterElemente
{
my $href = shift;
my $skey_suche=Dumper($href);
for my $pos (0..$#{$master})
{
my $skey_master=Dumper($$master[$pos]);
if($skey_master eq $skey_suche)
{
print "BINGO im Element an der Position $pos (".@{$master}." Elemente)!\n";
last;
}
}
}