The issue seems to be, that your "if" condition will never be met (wrong assumptions and/or too complicated?).
Note: XML is a free format, i.e. the content may be spread over multiple lines.
If you need to modify the whole XML file, then it's best to slurp in the whole file into one string and process that data at once.
Slurp from STDIN:
my $sep= $/;
undef $/;
my $buf = <stdin>;
$/ = $sep;</stdin>
Process the buffer:
$buf =~ s%(<book-part\s*[^/])%</book-part>\1%g;
Note: for better legibility, I've chosen % as regex separator.
The above mentioned solution is not the whole solution since it does not manage the first start tag nor the trailing closing tag properly. I need to see the original file (or the schema). See also my comment to your question.