jonnyfolk has asked for the wisdom of the Perl Monks concerning the following question:
I have been looking at extracting user_agent information from the wurfl web browsers patch using XML::Simple. I have succeeded in getting the info but it's very explicit - I was hoping that someone might show me how else this could be done. Thanks.
#!/usr/bin/perl -w use strict; print "Content-type: text/html\n\n"; # use module use XML::Simple; use Data::Dumper; use LWP::Simple; my $url = 'http://wurfl.sourceforge.net/web_browsers_patch.xml'; my $content = get($url); # create object my $xml = new XML::Simple; # read XML file my $data = $xml->XMLin($content); # print output my ($key, $value) = %{ $data }; ($key, $value) = %{ $value }; my @keys = keys %{ $value }; foreach (@keys) { print qq~$data->{devices}->{device}->{$_}->{user_agent}<br>\n~; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: WURFL web browsers patch and XML::Simple
by jethro (Monsignor) on Dec 14, 2009 at 10:01 UTC | |
by moritz (Cardinal) on Dec 14, 2009 at 11:43 UTC | |
by jonnyfolk (Vicar) on Dec 14, 2009 at 12:04 UTC | |
by jonnyfolk (Vicar) on Dec 14, 2009 at 10:44 UTC |