in reply to Changing XML Data

If the file is not "too big" (e.g. mega gigabytes?) you can just use XML::LibXML:
my $x = XML::LibXML->new; my $doc = $x->parse_file($file); my $root = $doc->getDocumentElement(); my ( $name, $content ) = qw(@name @content); for my $att ( $root->findnodes(qq[ //package/metadata/x-metadata/meta[$name='dtb:totalTime']/$content ]) ) { my $old_val = $att->value(); print "Changing value from $old_val to 345\n"; $att->setValue(345); } eval { $doc->toFile($file, 1) } or die "Could not write to $file: $@";