in reply to clrscr(); in perl?

Here are some of the options you have that I know of. There might be some more, but these should get you going.

  1. Try making a system call, e.g.,

    use system(); system ('cls'); # or equivalent on your system.

  2. Or look into the Term::Cap module available on CPAN.
    use Term::Cap; $t = Tgetent Term::Cap {TERM=>undef, OSPEED=>9600}; print $t->Tputs("cl");

  3. Or you could look at an even simpler module found again on CPAN, called Term::Screen, which allows you to do something like:
    use Term::Screen; my $terminal = new Term::Screen; $terminal->clrscr();

Hope this helps.

- wil

Replies are listed 'Best First'.
Re: (wil) Re: clrscr(); in perl?
by choocroot (Friar) on May 27, 2002 at 09:11 UTC
    on unix you can also use this :
    # store the terminal escape sequence that clear the screen $clear = `clear`; # then, all you need is to print $clear # anytime you want to clear the screen print $clear; # Bonus : # if you wants to know what the "clear" sequence # looks like (in decimal) foreach ( split(//,$clear) ) { print ord($_),"\n"; }
Re: clrscr(); in perl?
by Anonymous Monk on May 27, 2002 at 13:20 UTC
    Why are using the non-standard module 'system'? If you want to use the system function, just do so. This is Perl, not Python. ;-)