I don't think it depends on whether the "escape sequence" is send from CMD.EXE, I think it has to do with what system or BIOS call the program printing uses to print. Back in my old DOS programming days, there were basically three ways to print to the screen: via the DOS interrupt call, via the BIOS interrupt call, or by directly writing the data to the screen memory buffer. And I think the only way to get special characters interpretted specially was to print via the DOS interrupt call. Obviously, this most likely doesn't accurately reflect the current reality, but I wouldn't be suprised if it's something similar. *shrug*

Also of note is the fact that, if you load ANSI.SYS in your CONFIG.SYS, then doing print "\e[2J" from perl should clear the screen. That depends, of course, on whether you can require that module be loaded or not.

If you can't require ANSI.SYS be loaded, you could also look in to the Win32::Console::ANSI module on CPAN, which appears to emulate the functionality and includes support for the clear-screen escape sequence. Update: Or, perhaps more directly, Win32::Console's Cls.

bbfu
Black flowers blossom
Fearless on my breath


In reply to Re3: The difference between [system] and `backticks` and [qx//] (on win32) by bbfu
in thread The difference between [system] and `backticks` and [qx//] (on win32) by BrowserUk

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.