cog has asked for the wisdom of the Perl Monks concerning the following question:

I recently noticed that things like print "\r", print "\ec" and so on have different behaviour on different systems.

I know of the existence of several modules that can ease up these tasks, but still I have to ask:

Are there portable ways of clearing a line or even the screen without having to use modules?

Replies are listed 'Best First'.
Re: Terminal portability
by tilly (Archbishop) on Apr 10, 2005 at 19:34 UTC
    You can copy the code from the modules into your code and not use the module. (If you do so, please respect the copyrights that may be on said modules.)

    Personally I would see no good reason to avoid using modules for this problem if the modules work.

      I would see no good reason to avoid using modules

      I just don't like to use modules when I'm doing something like a japh :-)

Re: Terminal portability
by ambrus (Abbot) on Apr 10, 2005 at 22:18 UTC

    In short, no. The portable way to clear the screen is to find out how to do it from the terminfo description, and that's impossible without a module.

    You can try system"clear"; or system tput=>clear::; though, but those are far from portable.