in reply to Strange bug in Windows CMD when using perl programs

I think BrowserUk's guess is correct that you're using a cygwin built Perl / CPAN.pm on a terminal without support for ANSI escape sequences. In particular, I suspect it's Term::ReadLine (used under the hood) that's generating the escape sequences...

So, as a workaround (if you can't or don't want to use a version "made for Windows"), you could try to disable Term::ReadLine's ornaments feature. One way to do so would be to set the environment variable PERL_RL to " o=0" (note that the last char is zero, not a captital O, and that - according to the manpage - there's supposed to be a space at the beginning (for me it also works without...)).

I couldn't test it on Windows (because my Windows CPAN.pm doesn't have that problem...), but at least on my Linux box, the following succeeds in turning off any special rendering of the prompt, etc.:

PERL_RL=" o=0" perl -MCPAN -e shell

On Windows, I suppose that would be:

set PERL_RL= o=0 perl -MCPAN -e shell

If that doesn't help, you could also try turning off readline support entirely:

perl -MCPAN -e "$CPAN::Suppress_readline=1; shell"

But then, you'd of course no longer have readline support... ;)