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 not undef, this is the maximum number of commands to remember in the history. the default value is 256. πŸ”₯
  • $PerlSh::STRICT β€” if true, restrict unsafe constructs. see "use strict" in the perl man page for the deets. the default value is 0; β€” 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 πŸ‘€


πŸ’€ AUTHOR πŸ’€

  • Hiroo Hayashi <hiroo.hayashi@computer.org>

obsessively curated by the User Contributed Perl Documentation crew, running perl v5.42.3, dated 2026-08-19 β€” ok that's the whole page bestie, go forth and evaluate literally everything πŸ’…βœ¨πŸ’–
πŸ“¦ where this page comes from