Re: How do you clear the screen?⭐
by cleen (Pilgrim) on Jun 19, 2000 at 17:20 UTC
|
use Term::Cap. use the POSIX module to probe certain features of the terminal.
#!/usr/local/bin/perl
use POSIX;
use Term::Cap;
# General terminal line I/O
my $termios = new POSIX::Termios;
$termios->getattr;
# Extract the entry of the terminal type
my $term = Term::Cap->Tgetent( { OSPEED => $termios->getospeed } );
# clear
$term->Tputs('cl', 1, STDOUT);
| [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?⭐
by AgentM (Curate) on Mar 22, 2001 at 23:13 UTC
|
use Curses;
initscr();
refresh();
#use Curses calls for the rest of your program
| [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?⭐
by MrNobo1024 (Hermit) on Mar 23, 2001 at 04:45 UTC
|
Shell out and ask the OS to do it:
system $^O eq 'MSWin32' ? 'cls' : 'clear';
| [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?⭐
by osfameron (Hermit) on Mar 23, 2001 at 15:50 UTC
|
$CONSOLE->Cls();
$CONSOLE->Cls( $FG_WHITE | $BG_GREEN );
Where $CONSOLE is your blessed Console object. | [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?⭐
by wil (Priest) on May 27, 2002 at 10:07 UTC
|
use Term::Screen;
my $terminal = new Term::Screen;
$terminal->clrscr();
| [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?
by OeufMayo (Curate) on Mar 22, 2001 at 23:27 UTC
|
Come on! I'm surprised no one proposed this classic one:
print " " x 80*25;
You might want to modify the values to fit your screen
| [reply] [Watch: Dir/Any] [d/l] |
|
print "\n" x 25;
But I guess that's not as cool as printing spaces...
Update: Woohoo! My first post with a negative rep!
--isotope
http://www.skylab.org/~isotope/
| [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?⭐
by arhuman (Vicar) on Mar 22, 2001 at 12:51 UTC
|
# vt100 compliant terminal needed
print "\033[2J";
| [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?
by Anonymous Monk on Mar 22, 2001 at 08:08 UTC
|
Another, less complex method would entail:
print `clear` , "\n";
| [reply] [Watch: Dir/Any] |
|
Why the print stuff?
This is enough:
system('clear');
But it only works on *nix systems, it fails on win32. | [reply] [Watch: Dir/Any] [d/l] |
Re: How do you clear the screen?
by softworkz (Monk) on Jul 10, 2001 at 17:08 UTC
|
I'm running activestate perl 5.6.1 for mswin32
and I have found that system ("clear"); doesn't
work but the following code works fine.
#!/usr/bin/perl-w
use strict;
use Win32;
system ("cls");
| [reply] [Watch: Dir/Any] [d/l] |
|
I:\tmp>clear
'clear' is not recognized as an internal or external command,
operable program or batch file.
so system("clear") won't work because it's not a windows command. "cls" is.
~Particle | [reply] [Watch: Dir/Any] [d/l] [select] |
Re: How do you clear the screen?
by iFly (Initiate) on Feb 17, 2009 at 08:03 UTC
|
You could invoke the (system-specific) external command:
system "cls"; # dos
system "clear"; # unix
Originally posted as a Categorized Answer. | [reply] [Watch: Dir/Any] [d/l] |