# phpman > man > PERLSH(1p)

[PERLSH(1p)](https://www.chedong.com/phpMan.php/man/PERLSH/1p/markdown)                       User Contributed Perl Documentation                      [PERLSH(1p)](https://www.chedong.com/phpMan.php/man/PERLSH/1p/markdown)



## NAME
       perlsh - one-line perl evaluator with line editing function and       variable name
       completion function

## SYNOPSIS
         perlsh

## DESCRIPTION
       This program reads input a line, and evaluates it by perl interpreter, and prints the result.
       If the result is a list value then each value of the list is printed line by line.  This
       program can be used as a very strong calculator which has whole perl functions.

       This is a sample program [Term::ReadLine::Gnu](https://www.chedong.com/phpMan.php/perldoc/Term%3A%3AReadLine%3A%3AGnu/markdown) module.  When you input a line, the line editing
       function of GNU Readline Library is available.  Perl symbol name completion function is also
       available.

       Before invoking, this program reads _~/.perlshrc_ and evaluates the content of the file.

       When this program is terminated, the content of the history buffer is saved in a file
       _~/.perlsh_history_, and it is read at next invoking.

## VARIABLES
       You can customize the behavior of "perlsh" by setting following variables in _~/.perlshrc_;

       $[PerlSh::PS1](https://www.chedong.com/phpMan.php/perldoc/PerlSh%3A%3APS1/markdown)
           The primary prompt string.  The following backslash-escaped special characters can be
           used.

                   \h: host name
                   \u: user name
                   \w: package name
                   \!: history number

           The default value is `"\w[\!]$ "'.

       $[PerlSh::PS2](https://www.chedong.com/phpMan.php/perldoc/PerlSh%3A%3APS2/markdown)
           The secondary prompt string.  The default value is `"> "'.

       $[PerlSh::HISTFILE](https://www.chedong.com/phpMan.php/perldoc/PerlSh%3A%3AHISTFILE/markdown)
           The name of the file to which the command history is saved.  The default value is
           "~/.perlsh_history".

       $[PerlSh::HISTSIZE](https://www.chedong.com/phpMan.php/perldoc/PerlSh%3A%3AHISTSIZE/markdown)
           If not "undef", this is the maximum number of commands to remember in the history.  The
           default value is 256.

       $[PerlSh::STRICT](https://www.chedong.com/phpMan.php/perldoc/PerlSh%3A%3ASTRICT/markdown)
           If true, restrict unsafe constructs.  See "use strict" in perl man page.  The default
           value is 0;

## FILES
       _~/.perlshrc_
           This file is eval-ed at initialization.  If a subroutine "afterinit" is defined in this
           file, it will be eval-ed after initialization.  Here is a sample.

                   # -*- mode: perl -*-
                   # decimal to hexa
                   sub h { map { sprintf("0x%x", $_ ) } @_;}

                   sub tk {
                       $t->[tkRunning(1)](https://www.chedong.com/phpMan.php/man/tkRunning/1/markdown);
                       use Tk;
                       $mw = MainWindow->new();
                   }

                   # for debugging [Term::ReadLine::Gnu](https://www.chedong.com/phpMan.php/perldoc/Term%3A%3AReadLine%3A%3AGnu/markdown)
                   sub afterinit {
                       *t = \$[PerlSh::term](https://www.chedong.com/phpMan.php/perldoc/PerlSh%3A%3Aterm/markdown);
                       *a = \$[PerlSh::attribs](https://www.chedong.com/phpMan.php/perldoc/PerlSh%3A%3Aattribs/markdown);
                   }

       _~/.perlsh_history_
       _~/.inputrc_
           A initialization file for the GNU Readline Library.  Refer its manual for details.

## SEE ALSO
       [Term::ReadLine::Gnu](https://www.chedong.com/phpMan.php/perldoc/Term%3A%3AReadLine%3A%3AGnu/markdown) <<http://search.cpan.org/dist/Term-ReadLine-Gnu/>>

       GNU Readline Library <<https://tiswww.cwru.edu/php/chet/readline/rltop.html>>

## AUTHOR
       Hiroo Hayashi <<hiroo.hayashi@computer.org>>



perl v5.34.0                                 2022-02-06                                   [PERLSH(1p)](https://www.chedong.com/phpMan.php/man/PERLSH/1p/markdown)
