Thanks for the suggestions, I've inserted my code below. Please let me know if you see the code that is generating the blank space.

use strict;
use File::Find;
use File::Path;
use File::Copy;
my $folderPath = "C:/Folder1";

my %findReplaceH = (
q[<TList.Bullet>]=>q[<ul>],
q[</TList.Bullet>]=>q[</ul>],
<TList.Item>]=>q[<li>],
q[</TList.Item>]=>q[</li>],
my $useRegexQ = 0;
$folderPath =~ s[/$][];

$folderPath =~ m[/(\w+)$];
my $previousDir = $`;
my $lastDir = $1;

my $totalFileChangedCount = 0;
sub fileFilterQ ($) {
my $fileName = $_[0];

 if ($fileName =~ m{\.xml$}) {
print "processing: $fileName\n";
return 1;};

return 0;
};

sub processFile {
 my $currentFile = $File::Find::name; # full path spect
my $currentDir = $File::Find::dir;
my $currentFileName = $_;

if (not fileFilterQ($currentFile)) {
  return 1;
}
if (not(open FILE, "<$currentFile")) {die("Error opening file:
$!");};
 my $wholeFileString;
  {local $/ = undef; $wholeFileString = <FILE>;};
  if (not(close(FILE))) {die("Error closing file: $!");};

# do the replacement.
 my $replaceCount = 0;

 foreach my $key1 (keys %findReplaceH) {
    my $pattern = ($useRegexQ ? $key1 : quotemeta($key1));
  $replaceCount = $replaceCount + ($wholeFileString =~
s/$pattern/$findReplaceH{$key1}/g);
 };

if ($replaceCount > 0) { # replacement has happened
$totalFileChangedCount++;
# get the file mode.
my ($mode, $uid, $gid) = (stat($currentFile))[2,4,5];

  # write out a new file.
if (not(open OUTFILE, ">$currentFile")) {die("Error opening file: $!");};

 print OUTFILE $wholeFileString;
if (not(close(OUTFILE))) {die("Error closing file: $!");};

 # set the file mode.
 chmod($mode, $currentFile);
chown($uid, $gid, $currentFile);

 print "$replaceCount replacements made at\n";
  print "$currentFile\n";
}
};

In reply to Re^2: Remove blank space during find/replace by Melk
in thread Remove blank space during find/replace by Melk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.