use strict; use warnings; use XML::Twig; my $twig = XML::Twig->new (twig_roots => {content => \&contents}); my $xml = do {local $/; }; $twig->parse ($xml); sub contents { my ($twig, $contents) = @_; my @children = $contents->children (); my @wanted = qw(id title published); my $match = join '|', @wanted; my %params; for my $child (grep {$_->tag () =~ /^($match)$/} @children) { $params{$child->tag ()} = $child->text (); } print join "\t", @params{@wanted}; } __DATA__ http://gdata.youtube.com/feeds/api/videos/5InqyMvRZ8o/comments/7307D6E7F6E2D1B8 2007-04-05T12:05:42.000-07:00 2007-04-05T12:05:42.000-07:00 Fantastisk video,, ... Keep up the good work. - jeg glder mig meget til at se flere videoer fra dig..uper billeder du har fundet (: cajaneil http://gdata.youtube.com/feeds/api/users/cajaneil #### http://gdata.youtube.com/feeds/api/videos/5InqyMvRZ8o/comments/7307D6E7F6E2D1B8 Fantastisk video,, ... 2007-04-05T12:05:42.000-07:00