get_xpath is wicked cool. :) j BEFORE: } elsif ($message_type =~ /HotelResNotif/) { my $HRs = $twig->first_child("HotelReservations"); goto BARF if (!$HRs); my $HR = $HRs->first_child("HotelReservation"); goto BARF if (!$HR); my $RSs = $HR->first_child("RoomStays"); goto BARF if (!$RSs); my $RS = $RSs->first_child("RoomStay"); goto BARF if (!$RS); my $BPI = $RS->first_child("BasicPropertyInfo"); goto BARF if (!$BPI); $HotelCode = $BPI->att("HotelCode"); AFTER: } elsif ($message_type =~ /HotelResNotif/) { my (@x) = $twig->get_xpath('HotelReservations/HotelReservation/RoomStays/RoomStay/BasicPropertyInfo'); $HotelCode = $x[0]->att("HotelCode") if ($x[0]); |