Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^2: WURFL web browsers patch and XML::Simple

by moritz (Cardinal)
on Dec 14, 2009 at 11:43 UTC ( #812691=note: print w/replies, xml ) Need Help??

in reply to Re: WURFL web browsers patch and XML::Simple
in thread WURFL web browsers patch and XML::Simple

I can't see how that would ever work. for my $browser (%hash) iterates over both keys and values of the hash.

Since the keys are always strings, I can't see how $browser->{user_agent} works.

Did I miss something here?

Replies are listed 'Best First'.
Re^3: WURFL web browsers patch and XML::Simple
by jonnyfolk (Vicar) on Dec 14, 2009 at 12:04 UTC

    Ah, ok. So what I need to do to make it work is:

    foreach my $browser ( %{$data->{devices}->{device}} ) { print "$data->{devices}->{device}->{$browser}->{user_agent}<br>"; }

    I think that is an improvement on where I started as it goes into the heart of the data structure rather than disassembling it. However perhaps there is more that can be done?

    Update:The inclusion of values in jethro's update effectively fixes the problem, the solution direct and concise.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://812691]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2017-02-25 05:50 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (365 votes). Check out past polls.