use XML::Smart; open(my $fh, "<", "test.xml") or die $!; my $logString; while (<$fh>) { $logString .= $_; } my $test = XML::Smart->new($logString); $test->{log}->{logentry}[0]->{msg}->set_binary('FALSE'); print $test->data();