Y Y Y Y Y #### use strict; use warnings; use XML::Simple; #use Data::Dumper; # I put this here to see what the hash looks like my $check = "ABC"; my $alert_config_file = "C:/Path to XML/AlertCIMap.xml"; my $XMLSimple = XML::Simple->new(forcearray => 1, keyattr => {}); eval { $rules = $XMLSimple->XMLin("$alert_config_file")}; if ($@) { print "Problems Reading $alert_config_file: $@\n"; exit; } #print Dumper($rules); if (&CI_Exists($check)) { print "Matched\n"; } else { print "NOT FOUND\n"; } ## SUB ROUTINES ## sub CI_Exists #Check if CI exists in Mapping { my $chk = shift; my $rc = 0; #Foreach name in xml look for match my $ci = $rules->{CI}; foreach my $n(@$ci) { if ($n->{name} eq $chk){ print "Chk = $chk\n"; #Just for testing so I can see stuff is happening #THIS NEXT LINE IS CAUSING ME FRUSTRATION... my $rec_list = $n->{name}->{recipients}; #List of Recepients foreach my $recipient(@$rec_list) { #foreach Alert create file. print "Recipient = $recipient\n"; my $alert_list = # What should go here..?? List of Alerts foreach my $alert($alert_list){ print"I Would Send a $alert to $recipient\n"; } } $rc = 1; last; } } return($rc); }