#!/usr/local/bin/perl5.6.0 -w use strict; use Data::Dumper; use XML::Simple; my $html = q{ test waka waka waka waka waka
text text2
}; my $xs = XML::Simple->new(); my $ref = $xs->XMLin( $html, ForceContent => 1, KeepRoot => 1, ContentKey => 'content' ); for ( @{$ref->{html}->{body}->{errors}->{TMPL_IF}} ) { if ( $_->{NAME} eq 'INVALID_WIDGET_COLOR' ) { $_->{content} = 'changed it'; } } my $html_data = $xs->XMLout( $ref ); print Dumper( $html_data ); __END__