Perl FAQ 3.8: How can I use curses with perl?

Perl FAQ 3.8

How can I use curses with perl?

In release 4 of perl, the only way to do this was was to build a curseperl binary by linking in your C curses library as described in the usub subdirectory of the perl sources. This requires a modicum of work, but it will be reasonably fast since it's all in C (assuming you consider curses reasonably fast. :-) Programs written using this method require the modified curseperl, not vanilla perl, to run. While this is something of a disadvantage, experience indicates that it's better to use curseperl than to try to roll your own using termcap directly.

Fortunately, in version 5, Curses is a dynamically loaded extension by William Setzer*. You should be able to pick it up wherever you get Perl 5 from, or at least these places (expect that the version may change by the time you read this):

For a good example of using curses with Perl, you might want to pick up a copy of Steven L Kunz's* ``perl menus'' package (``'') via anonymous FTP from ``''. It's in the directory /pub/perl as: is a complete menu front-end for perl+curses and demonstrates a lot of things (plus it is useful to boot if you want full-screen menu selection ability). It provides full-screen menu selection ability for three menu styles (single-selection, multiple-selection, and ``radio-button''). The ``perl menus'' package also includes routines for full-screen data entry. A ``template'' concept is implemented to create a simple (yet flexible) perl interface for building data-entry screens for registration, database, or other record-oriented tasks. is supported on Perl4/curseperl and Perl5/Curses. Complete user documentation is provided along with several demos and ``beginner applications''. A menu utility module is provided that is a collection of useful Perl curses routines (such as "pop-up query boxes) that may be called from your applications.

Another possibility is to use Henk Penning's cterm package, a curses emulation library written in perl. cterm is actually a separate program with which you communicate via a pipe. It is available from [] via anonymous ftp. in the directory pub/PERL. You may also acquire the package via email in compressed, uuencoded form by sending a message to containing these lines:

    send PERL/cterm.shar.Z

See the question on retrieving perl via mail for more information on how to retrieve other items of interest from the mail server there.
Other resources at this site: