#!/usr/bin/perl use strict; use warnings; use XML::Twig; use v5.10; my $twig = XML::Twig->new(); $twig->parsefile( 'CC.xml'); my $looking_for_day = 'Tuesday'; foreach my $node ($twig->get_xpath('//Day[@day_of_week="' . $looking_for_day . '"]/Times/Time')) { say $node->att('start-time'); }