PERLSH(1p)
π PERLSH π
okay bestie, sit DOWN, because perlsh is literally the icon of the show β¨ and honestly? she deserves her own little corner of your terminal. π
it's a one-line perl evaluator β she comes with line editing and variable name completion, iykyk π«Ά
β¨ SYNOPSIS β¨
perlsh
that's it. that's the whole vibe. just run her. πΈ
π¦ DESCRIPTION π¦
so here's what she does, bestie: you type in a line, she hands it to the perl interpreter, evaluates it, and prints the result back at you. π
and if the result happens to be a list value</>? she doesn't cram it all on one line like some chaotic gremlin β nope, she prints each value of the list line by line. so clean. so organized. queen behavior. π
fr fr, you can use her as a VERY strong calculator that has the whole entire perl function arsenal behind her. like, the whole thing. every perl function. not a flex, just a fact. πͺ
she's also a sample program for the Term::ReadLine::Gnu module β so when you input a line, the line editing function of the GNU Readline Library is right there for you. π
and the Perl symbol name completion function? also available. you're welcome. β¨
before she even invokes, she reads ~/.perlshrc and evaluates the content of that file first. a little pre-game ritual, we love a routine. π
and when she gets terminated? π the content of the history buffer gets saved into ~/.perlsh_history, and she reads it back on the next invoke. so she remembers everything. every single thing. bestie never forgets. π«Ά
π VARIABLES π
you can customize the behavior of perlsh by setting these variables in ~/.perlshrc. yes, ALL of them, write them down. π
$PerlSh::PS1β the primary prompt string. you can use these backslash-escaped special characters in it:
\h: host name
\u: user name
\w: package name
\!: history number
the default value is "\w[\!]$ ". iconic little prompt, ngl. π
$PerlSh::PS2β the secondary prompt string. the default value is"> ". the quiet supporting character. πΈ$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, restrict unsafe constructs. see"use strict"in the perl man page for the deets. the default value is0;β so yeah, she's chill by default, but you can absolutely make her lock down. π«‘
π FILES π
~/.perlshrcβ this file is eval-ed at initialization. and if a subroutine named"afterinit"is defined in this file, it will be eval-ed after initialization. here's a sample, because we're generous:
# -*- 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 home. π she lives here, she comes back here. π~/.inputrcβ an initialization file for the GNU Readline Library. refer to its manual for the details, bestie, that's a whole other rabbit hole. π
π 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>
obsessively curated by the User Contributed Perl Documentation crew, runningperl v5.42.3, dated2026-08-19β ok that's the whole page bestie, go forth and evaluate literally everything π β¨π
π¦ where this page comes from
- ubuntu stonking: libterm-readline-gnu-perl 1.47-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms