in reply to XML::Simple and arrays
Now just fill in sub alert_recipient or whatever works for you and it should do as you wish.sub CI_Exists { my $chk = shift; my @nodes = map $rules->{CI}->{$_}, grep { $_ eq $chk } keys %{ $rules->{CI} }; foreach my $n (@nodes) { print "Chk = $chk\n"; foreach my $rec (keys %{ $n->{recipient} }) { foreach my $alert (@{$n->{recipient}->{$rec}->{alert}}) { ## or whatever suits alert_recipient(@$alert{qw/method dest/}, $rec) } } return 1; } return 0; }
_________
broquaint
update (broquaint): code now does the intended thing
update 2 (broquaint): fixed keys %$rules->{CI} (that'll teach me for posting untested code)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: XML::Simple and arrays
by J9 (Beadle) on Mar 07, 2003 at 15:13 UTC | |
by arturo (Vicar) on Mar 07, 2003 at 16:29 UTC |