use XML::Simple; $xml = new XML::Simple( ForceArray => [qw( product color )]); $file = $xml -> XMLin('./prod.xml', ); foreach $products (@{$file->{product}}) { print "Widget: " . $products->{title} ." \n"; print "Rating: " . $products->{rating} . "\n"; print " Cost: " . $products->{cost} . "\n"; print "Colors: " . (join ", ", @{$products->{color}})."\n\n"; } #### widget1 0.10 B red blue green widget2 0.25 S pink gray orange widget3 0.50 S white #### Widget: widget1 Rating: B Cost: 0.10 Colors: red, blue, green Widget: widget2 Rating: S Cost: 0.25 Colors: pink, gray, orange Widget: widget3 Rating: S Cost: 0.50 Colors: