I suspect the reason is the "-i". The following will work,
perl -pe 's/ */\t/g' compare_me_to.txt > compare_me_to.txt2
-i will want to write onto the file and create a backup. I suspect you'll have spotted chmod +w compare_me_to.txt
.
Just make sure that a double space is inserted before the * character, otherwise it will go wrong. Copying and pasting will avoid this.
This is a clearer solution because it avoids missing a space character,
perl -e 's/[ ][ ]*/\t/g' compare_me_to.txt > compare_me_to.txt2
and the solution you used .. (I did on OS X), what I'd recommend is,
perl -p -e 's/[ ][ ]*/\t/g' compare_me_to.txt # to see if it works by printing on screen without altering the file
perl -i -e 's/[ ][ ]*/\t/g' compare_me_to.txt
The -i flag will alter the original file and store a backup without requiring renaming the file.
What's it doing?
The regex [ ][ ]* structure is saying look a space and if one or more spaces occur adjacent to each other replace everything with a single tab. [ ]* means a "space" that is present or absent and if present it can be present an infinite number of times. If the [ ]* is by itself the command risks saying replace '' (zip) or 'space' with a tab, so tabs can appear at every '' (zilch), so tabs can appear everywhere. The "*" symbol in regex work differently to the "*" wildcard character in shell.