Click to See Complete Forum and Search --> : Clearing the screen in PERL


eXtremist
03-23-2001, 10:07 AM
Anyone know a command to clear the screen in PERL?

TheLinuxDuck
03-23-2001, 12:59 PM
It's easy to do using ansi escape codes, assuming your console supports ansi escape codes.. :)

2J will clear the screen, and 1;1H will move the cursor to the upper lefthand position

print "\e[2J\e[1;1H";

kmj
03-23-2001, 06:27 PM
hey, LD, an example on ansi escape codes would be cool. :)

TheLinuxDuck
03-23-2001, 06:36 PM
I could handle that. :) I've got a few other things (as we have discussed) that are my top priority for getting the new site up and running..

But, it will certainly be put on "the list"

:)

kmj
03-23-2001, 06:44 PM
;)

micxz
03-25-2001, 12:32 AM
Have you tried system(clear); ?

TheLinuxDuck
03-26-2001, 07:50 PM
Originally posted by micxz:
Have you tried system(clear); ?

That would certainly work, but why fork off a system call/shell when a simple ansi escape code will suffice? :)