#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use XML::Simple; my $currentSoftware = 321234472; my $data=get("http://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=$currentSoftware&mt=8"); my $ref = XMLin($data); print display_tree($ref,''); sub display_tree { my $ref=shift; my $shiftin=shift || ''; my $ret=''; if(ref($ref) eq 'ARRAY') { for my $cnt (0..$#$ref) { $ret.=$shiftin.$cnt; my $lst=display_tree($ref->[$cnt],$shiftin." "); if(index($lst,"\n")>-1) { $ret.=":\n".$lst; } else { $ret.="=$lst\n"; } } } elsif(ref($ref) eq 'HASH') { for my $key (sort keys(%$ref)) { $ret.=$shiftin.$key; my $lst=display_tree($ref->{$key},$shiftin." "); if(index($lst,"\n")>-1) { $ret.=":\n".$lst; } else { $ret.="=$lst\n"; } } } else { $ref=~s/[\n\r]/ /gs; $ret=$ref; } return $ret; }