#!/usr/bin/perl use strict; use warnings; use CGI qw(:standard); use CGI::Carp; use WWW::Mechanize; use XML::Simple; use YAML; use Encode; my $mech = WWW::Mechanize->new; my $api_base = 'http://api.bookmooch.com/api/userid'; my $q = CGI->new; my $user = $q->param('user'); $mech->get("$api_base?userids=$user"); die "Failed to get user $user from BookMooch" unless $mech->success; print header, start_html, "\n" ; my $xml = $mech->content; # $xml = encode('iso-8859-1', $xml); (doesn't fix the problem) my $data = XMLin($xml); print pre(Dump($data)), end_html;