From: "Beginner" <[EMAIL PROTECTED]>
> Yes that worked fine. Thanx. Within the same xml file structure I also
> have 
> 
>           'address' => {
>                        'line' => [
>                                  {
>                                    'line' => 'STARLING ROOFING'
>                                  },
>                                  {
>                                    'line' => '338 EUSTON ROAD'
>                                  },
>                                  {
>                                    'line' => 'DUBLIN'
>                                  },
>                                  {
>                                    'line' => {}
>                                  },
>                                  {
>                                    'line' => {}
>                                  },
>                                  {
>                                    'line' => {}
>                                  },
>                                  {
>                                    'line' => 'DB1 3BH'
>                                  }
>                                ]
>                      },
> 
> Using that principle I thought I could do
> 
> if (keys(%{$ref->{'address'}{line}[$j]->{line}}) ) {
>  print "Found ", $ref->{'address'}{line}[$j]->{line}, "\n";
> 
> But I am getting an error:
> Can't use string ("STARLING ROOFING") as a HASH ref while "strict
> refs" in use.
> 
> Am I accessing the values incorrectly?

Have a look at the XML::Simple's SuppressEmpty option. I think you'll 
have better luck with

        SuppressEmpty => ''
or maybe
        SuppressEmpty => undef

It's easier to test for undef than for an empty hash.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to