| PERLSH(1p) | User Contributed Perl Documentation | PERLSH(1p) |
perlsh - one-line perl evaluator with line editing function and
variable name completion function
perlsh
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 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.
You can customize the behavior of "perlsh" by setting following variables in ~/.perlshrc;
\h: host name
\u: user name
\w: package name
\!: history number
The default value is `"\w[\!]$ "'.
# -*- mode: perl -*-
# decimal to hexa
sub h { map { sprintf("0x%x", $_ ) } @_;}
sub tk {
$t->tkRunning(1);
use Tk;
$mw = MainWindow->new();
}
# for debugging Term::ReadLine::Gnu
sub afterinit {
*t = \$PerlSh::term;
*a = \$PerlSh::attribs;
}
Term::ReadLine::Gnu <http://search.cpan.org/dist/Term-ReadLine-Gnu/>
GNU Readline Library <https://tiswww.cwru.edu/php/chet/readline/rltop.html>
Hiroo Hayashi <hiroo.hayashi@computer.org>
| 2024-03-31 | perl v5.38.2 |