Feed on
Posts
Comments

to clear the terminal screen in a perl script, command:

system(“clear”);


Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

10 Responses to “clear the screen in perl”

  1. on 08 Jul 2008 at 10:36 am Biteybiteybitey

    Tried it and it come up as “‘clear’ is not recognized as an operable external command, operable program or batch file”
    Replaced “clear” with “cls” (DOS clear screen) and it works fine.

  2. on 04 Aug 2008 at 3:15 pm Marx0r

    Indeed, system(‘clear’) works only on Unix-based systems. So for multiplatform programs, that’s _not_ good.

    Printing the Form Feed (ASCII: 12) character should do the trick. I haven’t tried that, though.

  3. on 07 Dec 2008 at 9:32 pm Marc

    on windoze try system(“cls”)

  4. on 01 Feb 2009 at 9:09 pm Sameer

    Thanks Marc, system(“cls”) works in Windows.

  5. on 09 Feb 2009 at 7:25 pm nj

    windoze…zzz

  6. on 08 Apr 2010 at 11:34 am Brandon

    Printing the Form Feed character (\f) doesn’t appear to work in Windows. It adds an ‘ankh’ or ‘venus’ symbol to the screen.

    CODE:
    print “This text should not be visible”;
    #print “14″;
    #print “\xC”;
    print “\f”;
    print “This page left blank intentionally.”;

    OUTPUT:
    This text should not be visible♀This page left blank intentionally.

  7. on 08 Apr 2010 at 11:36 am Brandon

    That first commented print statement didn’t post accurately. It should be a backslash followed by the octal 014.

  8. on 09 Sep 2011 at 9:01 am Clarence Gibson

    14 Clear in perl on windows 7

  9. on 03 Nov 2011 at 4:47 pm Mark Daniels Zuckerburg

    Does the content code (One shown for issue) apply/work for a macintosh?

  10. on 10 Oct 2014 at 11:38 pm ClearPores facial cleansing system

    ClearPores facial cleansing system

    clear the screen in perl » from the desk of stinkpot

Did I get this wrong? Let me know!

Trackback URI | Comments RSS