Re: Iterate through a hashref using XML::Simple (real post) On 6/14/07, Ray  wrote:
snip
> Oh, one other thing.. What If I wanted to iterate over the "Code" tag
> as well? Notice there is 2 Code tags that mean different things. One
> is the Customer unique identifier ("LarryBoy") and the other is the
> Reject Code ("1234"). I am interested in iterating through the
> Customer Code.
> Thanks again for your help!
> Ray

Do you mean like this?

#!/usr/bin/perl

use strict;
use warnings;

use XML::Simple;

my $xml = XMLin(join "", );

for my $rec (@{$xml->{RejectRecord}}) {
        printf qq(customer %-9.9s had error %d "%s"\\n),
                $rec->{Customer_New}{Code},
                $rec->{Code},
                $rec->{Reason}
}
__DATA__


FAILURE: Attempt to add Customer has failed

LarryBoy

1234


FAILURE: Attempt to add Customer has failed

JimBob

1234



-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


