These are meant to be run from the command line on Unix-like systems. So far all of these are Perl scripts (work on 5.8.8 and/or 5.16.2 on Mac OS X, at least), so you can run them like any other Perl program (though they all need arguments); they should also work if set to executable. Many of these are fairly simple, so you could probably find similar things elsewhere. All are less than 3 kilobytes except plgrep.
Contents: base64, http-head, plgrep, perl-repl, thirdperson, uuniq
Encode or decode base 64 text.
Usage: base64 -e|-d [file...]
. -e for encode, -d for decode. The option must be specified, and no other options are supported.
Show the HTTP headers for any given URL.
Usage: http-head url [headers ...]
. (No options.)
Updated 2014-08-28: allows specifying additional HTTP headers, one header per argument. E.g., http-head www.example.com 'User-Agent: Mozilla/5.0'
Updated 2014-11-04: fixes a bug that caused it not to work with certain servers
Like grep
, but uses Perl syntax, since the version of grep
that came with my computer doesn't use Perl syntax.
Updated 2016-12-15 (version 3.0.1).
Some differences from normal grep
(besides using Perl regular expressions and not supporting all options):
--color
highlights the filename and line number as well as the match to make it easier to tell lines apart in multi-line matches. It can also be abbreviated -c
.
-r
, and if recursion is enabled the default file is the current directory rather than standard input.
--include
and exclude
can be abbreviated -I
and -E
-A
-e
), all of which must match.
More information (includes help and older versions); Download plgrep (10.85K) (source)
Prompts for Perl commands, then executes them. Other interpreters have this feature built-in, but I couldn't find it for Perl, so I made one. (Stands for Read–eval–print loop.)
Known issues: Currently there's no built-in functionality to start by loading subroutines from a file. The use
command still seems to work, though. Also no line editing. Also if the command you type is a print
statement, it prints the return value of print
(usually 1
, indicating success) afterwards.
Updated 2014-06-02: Control-C stops the currently-running command.
Not really useful, but may be mildly interesting. Converts first-person text into third-person text.
Like uniq
, but matches lines that are not next to each other.
Usage: uuniq [-cdilu] [-f #] [-c #] [file...]