nemo096
Posts: 26
Joined: Wed Dec 26, 2012 10:54 am

Simple Perl Command

Fri Dec 28, 2012 11:53 pm

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

User avatar
jojopi
Posts: 3085
Joined: Tue Oct 11, 2011 8:38 pm

Re: Simple Perl Command

Sat Dec 29, 2012 12:25 am

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";

nemo096
Posts: 26
Joined: Wed Dec 26, 2012 10:54 am

Re: Simple Perl Command

Sat Dec 29, 2012 1:16 pm

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?

Return to “Other programming languages”