#!/usr/bin/perl use strict; use warnings; use XML::Rules; my $xml = <<'XML'; 2011-04-09T11:12:22.049Z 121422 ABC 2012-04-09T11:12:22.049Z 13427 CDE 2010-04-09T11:12:22.049Z 89822 LKK XML my @rules = ( 'str' => 'as array', 'date' => 'as is', 'doc' => 'as array no content', 'all' => 'no content' ); my $parser = XML::Rules->new(rules => \@rules); my $data = $parser->parse( $xml ); my $max_value = 0; for my $chunk ( @{ $data->{all}{doc} } ) { for my $str ( @{ $chunk->{str} } ) { $str->{name} eq 'docuid' and $str->{_content} > $max_value and $max_value = $str->{_content}; } } print "The max value is: $max_value\n";