#!/usr/bin/perl -l package Beatle; use Class::MethodMaker new_hash_init => 'new', get_set => [qw(name instruments)], ; package main; use strict; use warnings; use XML::Simple; my $xml = XMLin(\*DATA, KeyAttr => []); for (@{$xml->{beatle}}) { my $beatle = Beatle->new(%$_); print $beatle->name, ":"; print "\t$_" for @{$beatle->instruments}; } __DATA__ Voice Bass Guitar Piano Voice Guitar Rhodes Voice Guitar Sitar Voice Drums Percussion