in reply to command line search and replace

I can reproduce your results in a DOS shell. When I change to double-quotes, it behaves as you desire (it removes all whitespace from the test.log file):
perl -i.txt -pe "s/\s//g" test.log