PERLSH(1)
π PERLSH(1) β like, the perlsh manual but make it cute π
okay bestie, gather round, because perlsh is about to become your new main character. it's a one-line perl evaluator with a line editing function and a variable name completion function, and honestly? it's giving genius.
β¨ SYNOPSIS β¨
perlsh
that's it. that's the whole vibe. just type it and go π«Ά
πΈ DESCRIPTION πΈ
so here's the tea: this program reads a line of input, evaluates it with the perl interpreter, and prints the result. no cap. and if the result is a list value, then every single value of that list gets printed line by line, one after another, like a little parade. π
lowkey you can use this as a very strong calculator that has the whole entire perl function set at its disposal. it's not just a calculator, it's THE calculator. ate.
this is a sample program for the Term::ReadLine::Gnu module. when you input a line, the line editing function of the GNU Readline Library is available to you. the perl symbol name completion function is also available. iconic behavior, fr fr.
before invoking, this program reads ~/.perlshrc and evaluates the content of that file. so you can set up your whole little world before it even says hi. π
and when this program is terminated, the content of the history buffer is saved in a file called ~/.perlsh_history, and it gets read again at the next invoking. it remembers. it cares. ππ
π¦ VARIABLES π¦
you can customize the behavior of perlsh by setting the following variables in ~/.perlshrc. so many knobs, so much power:
$PerlSh::PS1β the primary prompt string. you can use the following backslash-escaped special characters in it:
\h: host name
\u: user name
\w: package name
\!: history number
the default value is "\w[\!]$ ".
$PerlSh::PS2β the secondary prompt string. the default value is"> ".$PerlSh::HISTFILEβ the name of the file to which the command history is saved. the default value is"~/.perlsh_history".$PerlSh::HISTSIZEβ if it's notundef, this is the maximum number of commands to remember in the history. the default value is256.$PerlSh::STRICTβ if true, it restricts unsafe constructs. see"use strict"in the perl man page for the details. the default value is0.
π FILES π
~/.perlshrcβ this file is eval-ed at initialization. and here's the cute part: if a subroutineafterinitis defined in this file, it will be eval-ed after initialization. a whole little post-init glow-up. β¨ here's a sample:
# -*- 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;
}
~/.perlsh_historyβ the history file, bestie. it's where your whole command journey lives. π«Ά~/.inputrcβ an initialization file for the GNU Readline Library. refer to its manual for details, iykyk.
π SEE ALSO π
Term::ReadLine::Gnu<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> β the legend themselves. we stan. π
and that's a wrap on perlsh! this whole page came from perl v5.42.0 and it's dated 2025-07-25, so if you're reading this you're living in the future and it's serving. go forth and evaluate some lines, bestie. no notes. periodt. π β¨πΈ
π¦ where this page comes from
- fedora 43: perl-Term-ReadLine-Gnu 1.47-3.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms