Page 1 of 1

Simple Perl Command

Posted: Fri Dec 28, 2012 11:53 pm
by nemo096
I have written a few long Perl scripts on Windows and am going to add these to my other scripts on my Pi but I have a problem

In a few of my scripts I require a log on screen and to do this I used

Code: Select all

system("cls");
to clear the screen and then prompt for username and password but now when I use Geany and enter than line the screen won't change

Is there a different command for clearing the screen on the Pi?

Ethan

Re: Simple Perl Command

Posted: Sat Dec 29, 2012 12:25 am
by jojopi
You can use either of:

Code: Select all

system "clear";
system "tput", "clear";
(It is debatable which of these is more portable.)

However, the only advantage of using an external program is support for weird terminals. In practice all modern terminal emulators use mostly ANSI/VT100 escape sequences, so you may print them yourself:

Code: Select all

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

Re: Simple Perl Command

Posted: Sat Dec 29, 2012 1:16 pm
by nemo096
Thanks jojopi -

Code: Select all

system("clear")
worked perfectly.

Just to clear this up for myself anything i have inside a

Code: Select all

system("")
should be a terminal command?