my $t= XML::Twig->new( twig_handlers => { 'league/id' =>sub{ $leagueId = $_[1]->text;}, 'event/startDateTime' =>sub{ $date = $_[1]->text;}, 'event/homeTeam/name' =>sub{ $home = $_[1]->text;}, 'event/awayTeam/name' =>sub{ $away = $_[1]->text;}, 'event/periods/period/number' =>sub{ $period = $_[1]->text;}, 'event/periods/period/description' =>sub{ $perDescr = $_[1]->text;}, 'event/periods/period/maxBetAmount/moneyLine' =>sub{ $maxBetML = $_[1]->text;}, 'event/periods/period/moneyLine/homePrice' =>sub{ $homePrice = $_[1]->text;}, 'event/periods/period/moneyLine/drawPrice' =>sub{ $drawPrice = $_[1]->text;}, 'event/periods/period/moneyLine/awayPrice' =>sub{ $awayPrice = $_[1]->text; print "\nMoney,", $leagueId, " ", $date, " ", $home, " ", $away, " ", $period, " ", $perDescr, " ", $maxBetML, " ", $homePrice, " ", $drawPrice, " ", $awayPrice; } );