Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
#######
#
# E-scripts on Perl, Apache and cgis.
#
# Note 1: use the eev command (defined in eev.el) and the
# ee alias (in my .zshrc) to execute parts of this file.
# Executing this file as a whole makes no sense.
# An introduction to eev can be found here:
#
#   (find-eev-quick-intro)
#   http://angg.twu.net/eev-intros/find-eev-quick-intro.html
#
# Note 2: be VERY careful and make sure you understand what
# you're doing.
#
# Note 3: If you use a shell other than zsh things like |&
# and the for loops may not work.
#
# Note 4: I always run as root.
#
# Note 5: some parts are too old and don't work anymore. Some
# never worked.
#
# Note 6: the definitions for the find-xxxfile commands are on my
# .emacs.
#
# Note 7: if you see a strange command check my .zshrc -- it may
# be defined there as a function or an alias.
#
# Note 8: the sections without dates are always older than the
# sections with dates.
#
# This file is at <http://angg.twu.net/e/perl.e>
#           or at <http://angg.twu.net/e/perl.e.html>.
#        See also <http://angg.twu.net/emacs.html>,
#                 <http://angg.twu.net/.emacs[.html]>,
#                 <http://angg.twu.net/.zshrc[.html]>,
#                 <http://angg.twu.net/escripts.html>,
#             and <http://angg.twu.net/>.
#
#######





# «.debian»			(to "debian")
# «.perl-doc»			(to "perl-doc")
# «.arrays»			(to "arrays")
# «.BEGIN»			(to "BEGIN")
# «.Class::Accessor»		(to "Class::Accessor")
# «.Class::Tiny»		(to "Class::Tiny")
# «.die»			(to "die")
# «.do»				(to "do")
# «.dualvar»			(to "dualvar")
# «.eval»			(to "eval")
# «.file-test»			(to "file-test")
# «.filter»			(to "filter")
# «.foreach»			(to "foreach")
# «.hash»			(to "hash")
# «.join»			(to "join")
# «.last»			(to "last")
# «.multiline-comments»		(to "multiline-comments")
# «.namespace»			(to "namespace")
# «.package»			(to "package")
# «.Platypus»			(to "Platypus")
# «.Scalar::Util»		(to "Scalar::Util")
# «.split»			(to "split")
# «.sub»			(to "sub")
# «.ref»			(to "ref")
# «.refs»			(to "refs")
# «.repls»			(to "repls")
# «.qw»				(to "qw")
# «.say»			(to "say")
# «.scalar»			(to "scalar")
# «.sprintf»			(to "sprintf")
# «.types»			(to "types")
# «.universal»			(to "universal")
# «.use»			(to "use")
# «.use-strict»			(to "use-strict")
# «.use-warnings»		(to "use-warnings")
# «.wantarray»			(to "wantarray")
# «.hex2c»			(to "hex2c")
# «.perl-nle»			(to "perl-nle")
# «.perldb»			(to "perldb")
# «.mimelite_zsh1»		(to "mimelite_zsh1")
# «.mimelite_zsh2»		(to "mimelite_zsh2")
# «.Getopt::Std»		(to "Getopt::Std")
# «.argv»			(to "argv")
# «.argc»			(to "argc")
# «.Data::Dumper»		(to "Data::Dumper")
# «.Net::NNTP»			(to "Net::NNTP")
# «.reading_a_file_at_once»	(to "reading_a_file_at_once")
# «.eval_in_regsub»		(to "eval_in_regsub")
# «.filter»			(to "filter")
# «.db_files»			(to "db_files")
# «.eepitch-perl»		(to "eepitch-perl")
# «.sepia»			(to "sepia")
# «.cpan-2020»			(to "cpan-2020")




#####
#
# debian
# 2026sep04
#
#####

# «debian»  (to ".debian")
# (find-status   "perl-base")
# (find-vldifile "perl-base.list")
# (find-udfile   "perl-base/")
# (find-status   "perl-doc")
# (find-vldifile "perl-doc.list")
# (find-udfile   "perl-doc/")
# (find-status   "perl-modules-5.32")
# (find-vldifile "perl-modules-5.32.list")
# (find-udfile   "perl-modules-5.32/")



#####
#
# perl-doc
# 2007may18 / 2026sep02
#
#####

# «perl-doc»  (to ".perl-doc")
# (find-status   "perl-doc")
# (find-vldifile "perl-doc.list")
# (find-udfile   "perl-doc/")
# (find-man "1 perl")
# (find-man "1 perlintro")
# (find-man "1 perltoc")
# (find-man "1 perlsyn")
# (find-man "1 perldata")
# (find-man "1 perlop")
# (find-man "1 perlfunc")
# (find-man "1 perlfunc" "print LIST")

# (find-man "1 perlfaq")
# (find-man "1 perlfaq1")
# (find-man "1 perlfaq2")
# (find-man "1 perlfaq4")
# (find-man "1 perlfaq5")
# (find-man "1 perlfaq6")
# (find-man "1 perlfaq7")
# (find-man "1 perlfaq8")

# (find-man "1 perlrun")
# (find-man "1 perlrun" "-d\n")
# (find-man "1 perlrun" "-e commandline")
# (find-man "1 perldebug")

# (code-c-d "perlpod" "/usr/share/perl/5.32.1/pod/")
# (find-perlpodfile "")
# (find-perlpodfile "perlootut.pod")




#####
#
# arrays
# 2026sep03
#
#####

# «arrays»  (to ".arrays")
# (find-man "1 perlintro" "Perl variable types")
# (find-man "1 perlintro" "An array represents a list of values:")
# (find-man "1 perldata")
# (find-man "1 perldata" "The '$' symbol works" "semantically like the English word \"the\"")
# (find-man "1 perldata" "This means that you can, without fear of conflict, use" "the same name for a scalar variable, an array, or a hash")
# (find-man "1 perldata" "defined()")
# (find-man "1 perldata" "truncate an array down to nothing by assigning the null list () to it")
# (find-man "1 perldata" "scalar(@whatever) == $#whatever + 1;")
# (find-man "1 perldata" "The hex() and oct() functions")
# (find-man "1 perldata" "There is no double interpolation in Perl, so the $100 is left as is")
# (find-man "1 perldata" "The special literals __FILE__, __LINE__, and __PACKAGE__")
# (find-man "1 perldata" "__SUB__ gives a reference to the current subroutine")
# (find-man "1 perldata" "A word that has no other interpretation in the grammar will be treated" "as if it were a quoted string.  These are known as \"barewords\"")
# (find-man "1 perldata" "here-documents")
# (find-man "1 perldata" "List value constructors")
# (find-man "1 perldata" "An array can be accessed one scalar at a time")
# (find-man "1 perldata" "@b = (@a)[0,1];")

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
@animals = ("camel", "llama", "owl");
@numbers = (23, 42, 69);
@mixed   = ("camel", 42, 1.23);
print $animals[0];              # prints "camel"
print $animals[1];              # prints "llama"
print        $#mixed;           # 2
print $mixed[$#mixed];          # last element, prints 1.23
print @mixed + 0;
print @mixed < 5;
print $mixed;
@animals[0,1];                 # gives ("camel", "llama");
@animals[0..2];                # gives ("camel", "llama", "owl");
@animals[1..$#animals];        # gives all except the first element
print sort @animals;
print reverse @numbers;



#####
#
# BEGIN
# 2026sep04
#
#####

# «BEGIN»  (to ".BEGIN")
# (find-perlpodfile "perlfunc.pod" "The C<BEGIN> forces the L<C<require>|/require VERSION> and")
# (find-perlpodfile "perlmod.pod" "A C<BEGIN> code block is executed as soon as possible")



#####
#
# Class::Accessor
# 2026sep06
#
#####

# «Class::Accessor»  (to ".Class::Accessor")
# (find-sh "locate perl | grep Class | grep Accessor")
# /usr/lib/x86_64-linux-gnu/perl5/5.32/Class/MOP/Method/Accessor.pm
# (find-fline "/usr/share/perl5/Class/Accessor.pm")
# (find-fline "/usr/share/perl5/Class/Accessor/Fast.pm")
# (find-fline "/usr/share/perl5/Class/Accessor/Faster.pm")



#####
#
# Class::Tiny
# 2026sep06
#
#####

# «Class::Tiny»  (to ".Class::Tiny")
# (find-sh "locate perl | grep Class | grep Tiny")
# (find-fline "/usr/share/perl5/Class/")
# (find-fline "/usr/share/perl5/Class/Tiny.pm")
# (find-fline "/usr/share/perl5/Type/Tiny/Class.pm")
# (find-fline "/usr/share/perl5/Type/Tiny/Manual/UsingWithClassTiny.pod")




#####
#
# die
# 2026sep02
#
#####

# «die»  (to ".die")
# (find-man "1 perlfunc" "die LIST")
# (find-perlpodfile "perlfunc.pod" "L<C<die>|/die LIST> raises an exception")



#####
#
# do
# 2026sep02
#
#####

# «do»  (to ".do")
# (find-man "1 perlfunc" "do BLOCK")
# (find-man "1 perlfunc" "do EXPR")
# (find-man "1 perlfunc" "do EXPR" "cannot see lexicals")



#####
#
# dualvar
# 2026sep03
#
#####

# «dualvar»  (to ".dualvar")
# (find-google-links "how is dualvar implemented in perl")
# (find-perlbasegrep "grep --color=auto -nRH --null -e dualvar *")
# (find-perlbasvgrep "grep --color=auto -nRH --null -e dualvar *")

(find-2a ' (find-perlbasvfile "Scalar/Util.pm")
         ' (find-perlbasefile "Scalar/Util.pm")
         )

(find-2a ' (find-perlbasvfile "Scalar/Util.pm" "__END__\n\n=head1 NAME")
         ' (find-perlbasefile "Scalar/Util.pm" "__END__")
         )

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
use Scalar::Util qw(dualvar isdual);
$foo = dualvar 10, "Hello";
print $foo + 2;
print $foo . " world";



#####
#
# eval
# 2026sep04
#
#####

# «eval»  (to ".eval")
# (find-perl-links "eval")
# (find-perlpodgrep "grep --color=auto -nH --null -e '^=item eval' *.pod")
# (find-perlpodfile "perlfunc.pod" "=item eval EXPR")
# (find-perlpodfile "perlfunc.pod" "=item eval BLOCK")




#####
#
# file-test
# 2026sep04
#
#####

# «file-test»  (to ".file-test")
# (find-perlpodfile "perlfunc.pod" "-r  File is readable by effective uid/gid.")
# (find-perlpodfile "perlfunc.pod" "A file test, where X is one of the letters listed below")
# (find-man "1 perlfunc" "-X  A file test, where X is one of the letters listed below")





#####
#
# filter
# 2026sep04
#
#####

# «filter»  (to ".filter")
# (find-perlpodfile "perlfilter.pod")
# (find-man "1 perlfilter")
# https://metacpan.org/pod/Filter::Simple
# https://stackoverflow.com/questions/1785852/why-are-perl-source-filters-bad-and-when-is-it-ok-to-use-them
# https://stackoverflow.com/questions/28046693/perl-how-to-create-function-that-accepts-various-data-types Switch shouldn't be recommended. It's a source filter, it can cause strange bugs



#####
#
# foreach
# 2026sep06
#
#####

# «foreach»  (to ".foreach")
# (find-perl-links "foreach")
# (find-perlpodfile "perlfunc.pod" "=item foreach")
# (find-perlpodfile "perlintro.pod" "=item foreach")
# (find-perlpodfile "perlsyn.pod" "=head2 Compound Statements")
# (find-perlpodfile "perlsyn.pod" "LABEL foreach VAR (LIST) BLOCK")



#####
#
# hash
# 2026sep06
#
#####

# «hash»  (to ".hash")
# (to "namespace")
# (find-perlpodfile "perldata.pod" "Entire hashes are denoted by '%':")
# (find-perlpodfile "perlintro.pod" "=item Hashes")
# (find-perlpodfile "perlootut.pod" "In Perl most objects are hashes")
# (find-perlpodfile "perldata.pod" "This means that you can, without fear\nof conflict, use the same name for a scalar variable, an array, or\na hash")
# (find-perlpodfile "perlreftut.pod" "Similarly, to copy an anonymous hash, you can use")
# (find-perlpodfile "perlfunc.pod" "=item keys HASH")
# (find-perlpodfile "perlfunc.pod" "=item keys HASH")
# (find-google-links "how do I delete a key-value pair from a hash in perl")

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
%myhash = {2 => 20, 3 => 30};
print %myhash{2};
print %myhash;
print keys(%myhash);
foreach my $k (sort(keys %myhash)) { print $k, '=', %myhash{$k}, "\n"; }



#####
#
# join
# 2026sep06
#
#####

# «join»  (to ".join")
# (find-perl-links "join")
# (find-perlpodfile "perlfunc.pod" "=item join EXPR,LIST")




#####
#
# last
# 2026sep04
#
#####

# «last»  (to ".last")
# (find-perlpodfile "perlsyn.pod" "=head2 Loop Control")




#####
#
# multiline-comments
# 2026sep02
#
#####

# «multiline-comments»  (to ".multiline-comments")
# (find-perlpodfile "perlfaq7.pod" "=begin comment")
# (find-man "1 perlfaq7")
# (find-man "1 perlfaq7" "=begin comment")
# (find-man "1 perldebug" "Multiline commands\n")



#####
#
# namespace
# 2026sep04
#
#####

# «namespace»  (to ".namespace")
# (find-perl-links "namespace")
# (find-perlpodfile "perldata.pod" "This means that you can, without fear\nof conflict, use the same name for a scalar variable, an array, or\na hash")
# (find-perlpodfile "perlobj.pod" "Perl does not provide any special syntax for class definitions. A\npackage is simply a namespace containing variables and subroutines")

# (find-perl-links "namespace")
# (find-perlpodgrep "grep --color=auto -nH --null -e 'namespace' *.pod")
# (find-perlpodgrep "grep --color=auto -nH --null -e 'Namespace' *.pod")

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
%my_global = (key => 'value');
$hash_ref  = *{ $main::{my_global} }{HASH};
print $hash_ref->{key};     # Prints 'value'

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
%my_global = (key => 'value');
use Package::Stash;
$stash     = Package::Stash->new('main');
$hash_ref  = $stash->get_symbol('%my_global');
print $hash_ref->{key};     # Prints 'value'


# (find-sh "locate Stash")
# (find-fline "/usr/lib/x86_64-linux-gnu/perl5/5.32/Package/Stash/XS.pm")
# (find-man "3pm Package::Stash")
# (find-man "3pm Package::Stash::PP")
# (find-man "3pm Package::Stash::XS")
# (find-fline "/usr/share/perl5/Package/Stash.pm")
# (find-fline "/usr/share/perl5/Package/Stash/PP.pm")
# https://stackoverflow.com/questions/13076804/accessing-global-hash-in-a-subroutine-in-perl
# https://metacpan.org/pod/Package::Stash



#####
#
# package
# 2026sep06
#
#####

# «package»  (to ".package")
# (find-perl-links "package")
# (find-angg "PERL/twopackages.pl")
# (find-perlpodfile "perldata.pod" "There are two package separators in Perl: A double colon (C<::>) and a single\nquote (C<'>)")
# (find-perlpodfile "perlfunc.pod" "=item package NAMESPACE")
# (find-perlpodfile "perlobj.pod" "An object is simply a data structure that knows to which class it\nbelongs")
# (find-perlpodfile "perlobj.pod" "=head2 Method Invocation")
# (find-perlpodfile "perlobj.pod" "If the left hand side is a package name, it looks for the\nmethod in that package. If the left hand side is an object")
# (find-perlpodfile "perlobj.pod" "An attribute is a piece of data belonging to a particular object")
# (find-perlpodfile "perlootut.pod" "In Perl most objects are hashes")
# (find-perlpodfile "perlootut.pod" "Once a referent has been blessed, the C<blessed> function from the\nL<Scalar::Util> core module can tell us its class name")
# (find-perlpodfile "perlootut.pod" "use Scalar::Util 'blessed';")
# (find-perlpodfile "perlootut.pod" "use parent 'File';")
# (find-perlpodfile "perlootut.pod" "L<Class::Accessor> is the polar opposite of C<Moose>. It provides very\nfew features, nor is it self-hosting")
# (find-perlpodfile "perlootut.pod" "Finally, we have L<Class::Tiny>. This module truly lives up to its\nname")
# (find-google-links "How can I declare several perl packages in a single file")
# https://www.cs.ait.ac.th/~on/O/oreilly/perl/cookbook/ch13_01.htm




#####
#
# Platypus
# 2026sep06
#
#####

# «Platypus»  (to ".Platypus")
# (find-status   "libffi-platypus-perl")
# (find-vldifile "libffi-platypus-perl.list")
# (find-udfile   "libffi-platypus-perl/")

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
use FFI::Platypus;
$ffi = FFI::Platypus->new( api => 1 );
$ffi->lib(undef); # search libc
$ffi->function( puts => ['string'] => 'int' )->call("hello world");
$ffi->attach  ( puts => ['string'] => 'int' );
puts("hello world");

# (find-man "3pm FFI::Build")
# (find-man "3pm FFI::Build::File::Base")
# (find-man "3pm FFI::Build::File::C")
# (find-man "3pm FFI::Build::File::CXX")
# (find-man "3pm FFI::Build::File::Library")
# (find-man "3pm FFI::Build::File::Object")
# (find-man "3pm FFI::Build::MM")
# (find-man "3pm FFI::Build::Platform")
# (find-man "3pm FFI::Platypus")
# (find-man "3pm FFI::Platypus::API")
# (find-man "3pm FFI::Platypus::Buffer")
# (find-man "3pm FFI::Platypus::Bundle")
# (find-man "3pm FFI::Platypus::Closure")
# (find-man "3pm FFI::Platypus::Constant")
# (find-man "3pm FFI::Platypus::DL")
# (find-man "3pm FFI::Platypus::Function")
# (find-man "3pm FFI::Platypus::Internal")
# (find-man "3pm FFI::Platypus::Lang")
# (find-man "3pm FFI::Platypus::Lang::ASM")
# (find-man "3pm FFI::Platypus::Lang::C")
# (find-man "3pm FFI::Platypus::Lang::Win32")
# (find-man "3pm FFI::Platypus::Legacy")
# (find-man "3pm FFI::Platypus::Memory")
# (find-man "3pm FFI::Platypus::Record")
# (find-man "3pm FFI::Platypus::Record::Meta")
# (find-man "3pm FFI::Platypus::Record::TieArray")
# (find-man "3pm FFI::Platypus::Type")
# (find-man "3pm FFI::Platypus::Type::PointerSizeBuffer")
# (find-man "3pm FFI::Platypus::Type::StringArray")
# (find-man "3pm FFI::Platypus::Type::StringPointer")
# (find-man "3pm FFI::Platypus::TypeParser")
# (find-man "3pm FFI::Platypus::TypeParser::Version0")
# (find-man "3pm FFI::Platypus::TypeParser::Version1")
# (find-man "3pm FFI::Probe")
# (find-man "3pm FFI::Probe::Runner")
# (find-man "3pm FFI::Probe::Runner::Builder")
# (find-man "3pm FFI::Probe::Runner::Result")
# (find-man "3pm FFI::Temp")

* (eepitch-shell2)
sudo apt-get install    libffi-platypus-perl

debconf: falling back to frontend: Readline
Scanning processes...
Scanning processor microcode...
Scanning linux images...
Running kernel seems to be up-to-date.
Failed to check for processor microcode upgrades.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.




#####
#
# Scalar::Util
# 2026sep03
#
#####

# «Scalar::Util»  (to ".Scalar::Util")
# https://stackoverflow.com/questions/5180746/what-is-perl-equivalent-of-pythons-type-function
# https://stackoverflow.com/questions/28046693/perl-how-to-create-function-that-accepts-various-data-types
# (find-man "3perl Scalar::Util")
# (find-man "3perl Scalar::Util" "  dualvar")
# (find-fline "/usr/lib/x86_64-linux-gnu/perl-base/Scalar/Util.pm")
# (find-fline "/usr/lib/x86_64-linux-gnu/perl/5.32.1/Scalar/Util.pm")
# (find-perl-links "Scalar::Util")
# (find-perlpodgrep "grep --color=auto -nH --null -e 'Scalar::Util' *.pod")
# https://metacpan.org/pod/Scalar::Util



#####
#
# split
# 2026sep06
#
#####

# «split»  (to ".split")
# (find-perl-links "split")
# (find-perlpodgrep "grep --color=auto -nH --null -e '^=item split' *.pod")




#####
#
# sub
# 2026sep02
#
#####

# «sub»  (to ".sub")
# (find-man "1 perlintro" "sub logger {")
# (find-man "1 perlintro" "sub square {")
# (find-man "1 perlsub")
# (find-perlpodfile "perlintro.pod" "sub logger {")
# (find-perlpodfile "perlintro.pod" "sub square {")
# (find-perlpodfile "perlintro.pod" "return $result;")
# (find-perlpodfile "perlsub.pod")

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
print("Hello, world\n");
print "Hello, world\n";

sub foo { }
sub foo { my ($a,$b) = @_; print($a+$b); }
foo(2,3);




#####
#
# ref
# 2026sep04
#
#####

# «ref»  (to ".ref")
# (find-perlpodfile "perlfunc.pod" "=item ref EXPR")
# (find-perlpodfile "perlref.pod" "=head3 Backslash Operator")
# (find-perlpodfile "perlref.pod" "=head3 Anonymous Subroutines")
# (find-perlpodfile "perlreftut.pod" "C<[ ITEMS ]> makes a new, anonymous array, and returns a reference to\nthat array")
# (find-perlpodfile "perlreftut.pod" "You can always use an array reference, in curly braces, in place of\nthe name of an array.  For example, C<@{$aref}> instead of C<@array>")
# (find-perlpodfile "perlreftut.pod" "C<${$aref}[3]> is too hard to read, so you can write C<< $aref->[3] >>\ninstead")
# (find-perlpodfile "perlreftut.pod" "In between two B<subscripts>, the arrow is optional")
# (find-perlpodfile "perlreftut.pod" "To copy the array, use")
# (find-perlpodfile "perlreftut.pod" "Similarly, to copy an anonymous hash, you can use")
# (find-perlpodfile "perlreftut.pod")
# (find-perlpodfile "perllol.pod")
# (find-perlpodfile "perldsc.pod")
# https://stackoverflow.com/questions/5180746/what-is-perl-equivalent-of-pythons-type-function
# https://stackoverflow.com/questions/1731333/how-do-i-tell-what-type-of-value-is-in-a-perl-variable
# https://stackoverflow.com/questions/1399833/how-can-i-get-perls-ref-function-to-return-ref-io-and-lvalue

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
print ref(1);         # ''  (a false value)
print ref('string');  # ''  (a false value)
print ref([1, 2, 3]); # 'ARRAY'
print ref({a => 1});  # 'HASH'
print ref(\1);        # 'SCALAR'
print ref(\\1);       # 'REF'
print ref(sub {});    # 'CODE'

{package My::Object; sub new {bless {}}}
$obj = My::Object->new;
print ref($obj);      #  'My::Object'








#####
#
# refs
# 2026sep03
#
#####

# «refs»  (to ".refs")
# (find-perlpodfile "perlref.pod" "sub hashem {       +{ @_ } }   # ok")
# (find-perlpodfile "perlref.pod" "=head3 Anonymous Subroutines")
# (find-perlpodfile "perlref.pod" "$bar = $$scalarref;")
# (find-perlpodfile "perlref.pod" "$bar = ${$scalarref};")
# (find-perlpodfile "perlref.pod" "$arrayref->[0] = \"January\";")
# (find-perlpodfile "perlref.pod" "$hashref->{\"KEY\"} = \"VALUE\";")
# (find-perlpodfile "perlref.pod" "$coderef->(1,2,3);")
# (find-perlpodfile "perlref.pod" "=head3 Typeglob Slots")
# (find-perlpodfile "perldsc.pod")




#####
#
# repls
# 2026sep02
#
#####

# «repls»  (to ".repls")
# (find-google-links "repls for perl")
# https://www.reddit.com/r/perl/comments/15o9gjb/does_perl_have_a_real_repl/
# https://github.com/viviparous/preplish
# https://metacpan.org/pod/Reply
# https://metacpan.org/pod/Devel::REPL
# (find-zsh "availabledebs | sort | grep perl")
# (find-zsh "availabledebs | sort | grep perl | grep repl")
# (find-man "1 perltoc" "How can I use Perl interactively?")

# (find-status   "libdevel-repl-perl")
# (find-vldifile "libdevel-repl-perl.list")
# (find-udfile   "libdevel-repl-perl/")
# (find-status   "libreply-perl")
# (find-vldifile "libreply-perl.list")
# (find-udfile   "libreply-perl/")

# (find-man "1p reply")
# (find-man "1p reply" ".replyrc")

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)
reply
sub foo {
  print "Foo bar!"
}



#####
#
# qw
# 2026sep03
#
#####

# «qw»  (to ".qw")

# (find-man "1 perlfunc")
# (find-man "1 perlop")
# (find-man "1 perlop" "Perl's prefix dereferencing" "operators are typed: \"$\", \"@\", \"%\", and \"&\"")

# (find-man "1 perlfunc" "qw//")
# (find-man "1 perlfunc" "qw/STRING/")
# (find-man "1 perlop" "qw/STRING/")
# (find-man "1 perlop" "qw{}         Word list")



#####
#
# say
# 2026sep05
#
#####

# «say»  (to ".say")
# (find-perl-links "say")
# (find-perlpodfile "perlfunc.pod" "=item say FILEHANDLE LIST")
# (find-perlpodfile "perllol.pod" "use 5.010;  # so we can use say()")




#####
#
# scalar
# 2026sep03
#
#####

# «scalar»  (to ".scalar")
# (find-perlpodfile "perltoc.pod" "=item Perl Functions by Category")
# (find-man "1 perltoc" "Perl Functions by Category")
# (find-man "1 perlfunc" "scalar EXPR")
# (find-man "1 perlfunc" "  scalar EXPR")
# (find-perl-links "scalar")
# (find-perlpodfile "perlfunc.pod" "=item scalar")



#####
#
# sprintf
# 2026sep03
#
#####

# «sprintf»  (to ".sprintf")
# (find-perlpodfile "perlfunc.pod" "=item sprintf FORMAT, LIST")
# (find-perlpodfile "perlop.pod" "Binary C<\".\"> concatenates two strings")



#####
#
# types
# 2026sep03
#
#####

# «types»  (to ".types")
# (find-man "1 perlintro" "Perl variable types")



#####
#
# universal
# 2026sep04
#
#####

# «universal»  (to ".universal")
# (find-perlpodgrep "grep --color=auto -niH --null -e 'universal' *.pod")
# (find-sh "locate -i universal | grep -i perl")
# https://perldoc.perl.org/UNIVERSAL
# (find-man "3perl UNIVERSAL")
# (find-fline "/usr/share/perl/5.32.1/UNIVERSAL.pm")
# (find-fline "/usr/share/perl5/UNIVERSAL/Object/ID.pm")




#####
#
# use
# 2026sep04
#
#####

# «use»  (to ".use")
# (find-perl-links "use")
# (find-perlpodfile "perlfunc.pod" "=item use Module VERSION LIST")
# (find-perl-links "@INC")
# (find-perl-links "%INC")
# (find-perlpodfile "perlvar.pod" "=item @INC")
# (find-perlpodfile "perlvar.pod" "=item %INC")



#####
#
# use-strict
# 2026sep06
#
#####

# «use-strict»  (to ".use-strict")
# (find-perlpodgrep "grep --color=auto -nH --null -e 'use strict' *.pod")
# (find-perlpodfile "perldebtut.pod" "=head1 use strict")
# (find-perlpodfile "perl.pod" "B<use strict> and B<use warnings>.  These will often point out exactly")
# (find-sh "locate perl | grep strict")



#####
#
# use-warnings
# 2026sep06
#
#####

# «use-warnings»  (to ".use-warnings")
# (find-perlpodgrep "grep --color=auto -nH --null -e 'use warnings' *.pod")
# (find-perlpodfile "perldebug.pod" "First of all, have you tried using L<C<use strict;>|strict> and\nL<C<use warnings;>|warnings>?")
# (find-perlpodfile "perlfaq7.pod" "under C<use warnings>, you can promote the warning to an error")
# (find-sh "locate perl | grep warnings")

/usr/lib/x86_64-linux-gnu/perl-base/warnings
/usr/lib/x86_64-linux-gnu/perl-base/warnings.pm
/usr/lib/x86_64-linux-gnu/perl-base/warnings/register.pm
/usr/lib/x86_64-linux-gnu/perl/5.32.1/CORE/warnings.h
/usr/share/man/man3/encoding::warnings.3perl.gz
/usr/share/man/man3/warnings.3perl.gz
/usr/share/man/man3/warnings::register.3perl.gz
/usr/share/perl/5.32.1/encoding/warnings.pm
/usr/share/perl/5.32.1/warnings
/usr/share/perl/5.32.1/warnings.pm
/usr/share/perl/5.32.1/warnings/register.pm





#####
#
# wantarray
# 2026sep03
#
#####

# «wantarray»  (to ".wantarray")
# (find-perl-links "wantarray")
# (find-perlpodfile "perlfunc.pod" "=item wantarray")
# (find-perlpodfile "perldata.pod" "=head2 Context")
# (find-perlpodfile "perldata.pod" "Certain operations\nreturn list values in contexts wanting a list, and scalar values\notherwise")
# (find-perlpodfile "perldata.pod" "User-defined subroutines may choose to care whether they are being\ncalled in a void, scalar, or list context")
# (find-perlpodfile "perldata.pod" "See L<perlfunc/wantarray>\nfor how you would dynamically discern your function's calling\ncontext")

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
print [2,3];









#####
#
# hex2c
# 2007may18
#
#####

# «hex2c»  (to ".hex2c")
# (find-man "1 perlfunc" "hex EXPR")
# (find-man "1 perlfunc" "chr NUMBER")
# (find-man "1 perlfunc" "write EXPR")
# (find-man "1 perlop")
# (find-man "1 perlop" "m//")
# (find-man "1 perlfunc" "print")
# (find-man "1 perlfunc" "printf FORMAT, LIST")

# "write" doesn't work as I expected... ask for help

#*
echo '40 20.33 _ 0a' \
  | tr ' .' \\n \
  | perl -nle 'if (/^[0-9A-Za-z][0-9A-Za-z]$/) { print hex($_) }'

#*

* (eepitch-shell)
* (eepitch-kill)
* (eepitch-shell)

perl -d -e 42
write("foo\n")
write "foo\n"
;
flush;
hex("40");
print hex(40);
print hex("40");
print chr(hex("40"));





#####
#
# perl -nle
# 2000dec26
#
#####

# «perl-nle»  (to ".perl-nle")
# (eeman "1p perlrun" "^ *-n")
# (eeman "1p perlrun" "-nle")
# (eeman "1p perlrun" "^ *-l")
# (eeman "1p perlrun" "^ *-e")
#*
ls /tmp | perl -nle '$n++; print "$n: \"$_\""'
ls /tmp | perl -nle 'print'
ls /tmp | perl -nle 'printf "\"%s\"\n", $_'
ls /tmp | perl -le 'while (<>) { printf "($_)" }'
ls /tmp | perl -e 'while (<>) { print "($_)" }'
#*
# (eeman "1p perlop" "The null filehandle <>")
# Use <STDIN> when you don't want the ARGV trick.





#####
#
# perldb
# 2000nov17
#
#####

# «perldb»  (to ".perldb")
# (find-pl5podfile "")
# (find-pl5podfile "perlfaq3.pod" "How can I use Perl interactively?")
# (find-pl5podfile "perldebug.pod")
# (eeman "perlfaq3" "interactively")
# (eeman "perldebug")
# (find-pl5file "5.004/perl5db.pl")
# (find-pl5file "5.005/perl5db.pl")

#*
cat > $EEG <<'---'
h

h h
|h h
---
eeg perl -de 42
#*

# (perldb "perl /usr/sbin/update-alternatives --display wish")
# (find-angg ".emacs" "gdbk-mode")
#*
# (gdbk-perldb t "/usr/sbin/update-alternatives --display wish" "" t)
#*
# (gdbk-perldb nil "/usr/sbin/update-alternatives --display wish")




#####
#
# string escape codes
# 2000jul24
#
#####

# «escape_codes»

perl -e 'print "\100\n";'




#####
#
# opcodes
#
#####

apti perl-5.004-debug
aptrm perl-5.004-debug

# (find-status "perl-5.004-debug")
# (find-vldifile "perl-5.004-debug.list")
# (find-fline "/usr/doc/perl-5.004-debug/")

cd /usr/lib/perl5/5.004/pod/
agrep -i opcode * | l -S
# (eeman "perlguts" "Examining the tree")

pdsc /debian/main/source/interpreters/perl_5.004.04-6.dsc
cd /usr/src/perl-5.004.04

# 
# (find-fline "/usr/src/perl-5.004.04/debian/rules" "-D optimize='-O2' ")

debian/rules binary |& tee odrb





#####
#
# Indexing
#
#####

cd /usr/lib/perl5/
find * -type f | grep -v '\.so$\|\.a$' > .files




#####
#
# ?
#
#####

# (find-fline "~/PERL/promit")
# (setq w3-reuse-buffers 'yes)
# (w3-open-local "/snarf/http/agora.leeds.ac.uk/Perl/start.html")

http://agora.leeds.ac.uk/Perl/start.html

Operações importantes: limpa os espaços, 

cd /usr/lib/perl5/
pod2man CGI.pm | groff -Tascii -man | l


echo foobarplic | sed s/o/O/g
echo foobarplic | sed 's/[oa]//g'

# (find-fline "~/PERL/mysed")





#####
#
# CGI.pm
#
#####

# (find-fline "/usr/doc/perl/examples/cgi/")
# (find-pl5file "")
# (find-pl5file "CGI/")
# (find-pl5file "CGI.pm")
# (find-pl5file "CGI.pm" "=head1 DEBUGGING")

# (find-pl5file "CGI.pm" "strong")
# (find-pl5file "CGI.pm" "as_string")

# (find-fline "/etc/apache/")
# (find-fline "/etc/apache/httpd.conf")
# (find-fline "/etc/apache/srm.conf" "/var/www")
# (find-fline "/etc/apache/srm.conf" "AddHandler cgi-script .cgi")

# (find-fline "/usr/doc/perl/examples/cgi/")
# (find-fline "/var/www/perlex/")

rm -Rv /var/www/perlex/
mkdir /var/www/perlex/
cd /var/www/perlex/
cp -iv /usr/doc/perl/examples/cgi/* .
gzip -dv *
perl RunMeFirst

chmod 755 *.cgi
chown edrx:edrx -Rc /var/www/perlex

# (w3-fetch "http://0/perlex/")
lynx http://0.0.0.0/perlex/


# (find-fline "/var/www/perlex/tryit.cgi")
cd /var/www/perlex/
tryit.cgi ''
tryit.cgi name=Edrx%20Foo color=Blue


# (find-pl5podfile "perlfaq4.pod")
# (find-pl5podfile "perlfaq5.pod")
# (find-pl5podfile "perlfaq6.pod")
# (find-pl5podfile "perlfaq7.pod")
# (find-pl5podfile "perlfaq8.pod")
# (find-pl5podfile "perlfaq9.pod" "send/read mail")

dpkg -i ~/HASH/mailtools
# (find-pl5file "Mail/")
# (find-pl5file "Mail/Send.pm")
# (find-pl5file "auto/Mail/")
# (find-fline "~/PERL/m")

    use Mail::Internet;
    use Mail::Header;
    # say which mail host to use
    $ENV{SMTPHOSTS} = 'mail.frii.com';
    # create headers
    $header = new Mail::Header;
    $header->add('From', 'gnat@frii.com');
    $header->add('Subject', 'Testing');
    $header->add('To', 'gnat@frii.com');
    # create body
    $body = 'This is a test, ignore';
    # create mail object
    $mail = new Mail::Internet(undef, Header => $header, Body => \[$body]);
    # send it
    $mail->smtpsend or die;



cd /var/www/perlex/
a2ps -o ~/o.ps -M A4dj -6 -A --highlight-level=none $(
  cat index.html |
  perl -e 'foreach $li (<STDIN>) {$li =~ s/.*"(.*.cgi)".*/$1/ && print $li;}')
cd
rm o.p[0-9][0-9]
gs -sDEVICE=djet500 -r300 -sOutputFile=o.p%02d -dNOPAUSE -dBATCH o.ps
rm o.zip; zip o.zip o.p0?
laf o.zip


cat index.html |
  perl -e 'foreach $li (<STDIN>) { print $li;}' 



# (find-pl5file "CGI.pm")
# (find-pl5file "CGI.pm")
# (find-pl5file "pod/perlmod.pod")
qualified



# (w3-open-local "/usr/doc/HOWTO/html/Java-CGI-HOWTO.html")






#####
#
# dwww
#
#####

# (find-hamm "dwww")




######
#
# Embedding Perl in text
#
######

#!/usr/bin/perl
print "a$BO\n";
print 'b$BO\n';
print 'c', 'foo';
print "\n\n\n";

(defun p ()
  (interactive)
  (write-region (get-register ?b) (get-register ?e) "~/PERL/p")
  (set-file-modes "~/PERL/p" 511))


#!/usr/bin/perl
$_ = "foo_bar";
print "Ok\n" if /.*foo.*/;
print /.*o\(.*a\).*/;

print "hello", "\n";
print ($a = [1, 2, 3]), "\n";

# (find-fline "~/PERL/tut0")

#!/usr/bin/perl
# (set-file-modes (buffer-file-name) 511)





######
#
# Docs
#
######

/snarf/ftp/agora.leeds.ac.uk/scs/doc/whole-perl-tutorial.readme
/snarf/http/www.eecs.nwu.edu/perl/perl.html

(find-fline "~/ZHTML/texps.ht")
(find-fline "/snarf/ftp/agora.leeds.ac.uk/scs/doc/whole-perl-tutorial.txt.gz")
(find-fline "/usr/doc/perl/examples")

(find-fline "/usr/doc/perl/examples/cgi/")




#######
#
# a2ps on some docs
#
#######

l ~/TCL/spawn-send-expect-interact

a2ps -8 -M A4dj -o ~/o.ps /usr/lib/perl5/CGI.pm
rm ~/o.p[0-9][0-9]
cd
gs -sDEVICE=djet500 -r300 -sOutputFile=o.p%02d -dNOPAUSE -dBATCH o.ps
rm o.zip; zip o.zip o.p0{1,2,3,4,5,6,7}
rm o.zip; zip o.zip o.p{0{8,9},1{0,1}}

# (find-node "(a2ps)Top")
# (find-node "(a2ps)Sheets Options")
# (find-fline "/usr/share/a2ps/sheets/")
# (find-fline "/usr/share/a2ps/sheets/perl.ssh")





#####
#
#
#
#####

cd /usr/lib/perl5/
etags $(find * -name '*.p[ml]')
# (code-c-d "pl5" "/usr/lib/perl5/")
# (find-pl5file "CGI.pm")

# (find-enode "Programs")
# (find-enode "Font Lock")
# (global-font-lock-mode t)
# (list-faces-display)

# (find-pl5file "i386-linux/5.004/DynaLoader.pm")
# (find-pl5file "i386-linux/5.004/auto/DynaLoader/")
# (find-pl5file "pod/perlxs.pod")
# (find-pl5file "pod/perlxstut.pod")




######
#
# perl-tk
#
######

# (find-fline "/usr/doc/perl-tk/")
# (find-fline "/usr/lib/perl5/Tk/")
# (code-c-d "ptk" "/usr/src/perl-tk-400.202/")
# (find-ptkfile "Manifest")
# (find-ptkfile "")

debsource /debian/main/source/interpreters perl-tk 400.202 -9
cd /usr/src/perl-tk-400.202/
cd /usr/src/perl-tk-400.202/demos/
widget




#####
#
# Sending MIME'd mail with MIME::Lite (and zsh)
#
#####

# «mimelite_zsh1»  (to ".mimelite_zsh1")
# Old version:

function mailfile () {
  TO=$1 FILE=$2 perl -e '
    use lib "$ENV{HOME}/PERL/";
    use MIME::Lite;
    $msg = new MIME::Lite
        # From  => $ENV{"FROM"},
        To      => $ENV{"TO"},
        Subject => $ENV{"FILE"},
        Data    => "";
    attach $msg
        Encoding => "base64",
        Type     => "BINARY",
        Path     => $ENV{"FILE"},
        Filename => $ENV{"FILE"};
    if (open SENDMAIL, "|/usr/sbin/sendmail -t -oi -oem") {
        $msg->print(\*SENDMAIL);
        close SENDMAIL;
    } else {
        print "Erro interno no sendmail: !=$!, ?=$?.\n";
    }'
}
# Demo:
cd ~/GIMP/; mailfile edrx tmp.jpg



# «mimelite_zsh2»  (to ".mimelite_zsh2")
# New version:

# Note that I'm using "su -s /usr/sbin/sendmail edrx --" instead of
# simply "/usr/sbin/sendmail".
function email_mimelite () {
  perl -e 'use lib "$ENV{HOME}/PERL/"; use MIME::Lite;
    '$1'
    if (open SENDMAIL, "|su -s /usr/sbin/sendmail edrx -- -t -oi -oem") {
      $msg->print(\*SENDMAIL); close SENDMAIL;
    } else { print "Erro interno no sendmail: !=$!, ?=$?.\n";
    }'
}
function email850 () {
  850toiso | TO=$1 SUBJ=$2 email_mimelite '
    undef $/;
    $msg = new MIME::Lite
      To       => $ENV{"TO"},
      Subject  => $ENV{"SUBJ"},
      Encoding => "quoted-printable",
      Data     => <>;'
}
function emailfile () {
  TO=$1 FILE=$2 email_mimelite '
    $msg = new MIME::Lite
      To      => $ENV{"TO"},
      Subject => $ENV{"FILE"},
      Data    => "";
    attach $msg
      Encoding => "base64",
      Type     => "BINARY",
      Path     => $ENV{"FILE"},
      Filename => $ENV{"FILE"};'
}

# Demos:
email850 edrx 'no subject' < ~/PERSONAL/99jun24
cd ~/GIMP/; emailfile edrx tmp.jpg





#####
#
# CPAN
# 99nov27
#
#####

# (find-fline "~/ICON/lslR2find.icn")
# (find-fline "$SDEBIAN/ls-lR")
# (find-fline "$SDEBIAN/ls-lR.i")
# (find-fline "$SCPAN/ls-lR")
# (find-fline "$SCPAN/ls-lR.i")

psne $FCPAN/ls-lR.gz
cd $SCPAN
gzip -dv ls-lR.gz

cd $SCPAN
~/ICON/lslR2find2 25 33 47 < ls-lR > ls-lR.i

psne $FCPAN/authors/id/LDS/CGI.pm-2.56.tar.gz




cd $SCPAN
~/ICON/lslR2find 2 -10 < ls-lR |& l -S
~/ICON/lslR2find 1 -10 < ls-lR |& l -S
~/ICON/lslR2find 0 -10 < ls-lR |& l -S

~/ICON/lslR2find 0 -8 < ls-lR |& l -S

cd $SCPAN
~/ICON/lslR2find2 25 33 46 < ls-lR |& l -S
~/ICON/lslR2find2 26 33 47 < ls-lR |& l -S
~/ICON/lslR2find2 27 34 48 < ls-lR |& l -S




#####
#
# Getopt::Std
# 2000may08
#
#####

# «Getopt::Std»  (to ".Getopt::Std")
# (eeman "Getopt::Std")
#*
cat > /tmp/p <<'---'
  use Getopt::Std;
  use Net::SMTP;
  getopt('s');
  print ":$opt_s:$ARGV[0]:\n"
---
perl /tmp/p -s 'Foo' Bar
perl /tmp/p -s 'Foo'
perl /tmp/p          Bar
perl /tmp/p
#*
# Options after the straight args don't work:
perl /tmp/p Bar -s 'Foo'


# Were is it said that GNU's getopt accepts options after the other
# args? Not in the obvious place:

# (find-node "(libc)Getopt")



#####
#
# argv and argc
#
#####

# «argv»  (to ".argv")
# (find-man "1 perlvar" "@ARGV")
# (find-man "1 perldata" "$#days")

#*
# «argc»  (to ".argc")
# About argc:
perl -e 'print ":", @ARGV+0, ":\n";'
perl -e 'print ":", @ARGV+0, ":\n";'  an_arg
#*
perl -e 'print ":$#ARGV:\n";'
perl -e 'print ":$#ARGV:\n";' foo
perl -e 'print ":$#ARGV:\n";' foo bar
perl -e 'print ":$#ARGV:\n";' foo bar plic
#*




#####
#
# sendEmail
# 2000may08
#
#####

# «sendEmail»

# (find-fline "$S/http/marvin.criadvantage.com/caspian/Software/SendEmail/sendEmail-v1.20.tar.gz")

rm -Rv /usr/src/sendEmail/
cd /usr/src/
tar -xvzf $S/http/marvin.criadvantage.com/caspian/Software/SendEmail/sendEmail-v1.20.tar.gz
cd /usr/src/sendEmail/

# (find-fline "/usr/src/sendEmail/sendEmail")
# (find-fline "/usr/src/sendEmail/sendEmail" "sub help")

cd /usr/src/sendEmail/
./sendEmail -f hahaha -t edrx -u Teste -m Hello -vv


# But instead of learning enough of this to use it to send email from
# my machine bypassing the broken exim, I decided to perfect my code
# that called Net::SMTP... and solved the problem.

# (find-es "mail" "Net::SMTP2")
# (find-fline "~/bin/sendemail")





#####
#
# Data::Dumper
# 2000may09
#
#####

# «Data::Dumper»  (to ".Data::Dumper")

# (eeman "CGI")
# (eeman "CGI" "CGI.INPUTFILE.")
# (find-pl5file "5.005/Data/Dumper.pm" "=head1")
# pod2t /usr/lib/perl5/5.005/Data/Dumper.pm |& l

#*
echo foo=bar > /tmp/oc
cat > /tmp/p <<'---'
  use CGI;
  open(QF, "/tmp/oc");
  $query = new CGI(QF);
  #
  use Data::Dumper;
  print Dumper('$query', $query);
  sub pdump { print "\n  $_[0] =\n", Dumper($_[1]); }
  pdump('$query', $query);
---
perl /tmp/p
#*
# And this one shows some things about references.
# (eeman "perlref")

cat > /tmp/p <<'---'
  use Data::Dumper;
  sub pdump { print "\n  $_[0] =\n", Dumper($_[1]); }
  @a = ['aa', 'bb'];
  $b = \@a;
  $c = ['aa', 'bb'];
  pdump('@a', @a);
  pdump('$b', $b);
  pdump('$c', $c);
  pdump('join', join('', @$c));
---
perl /tmp/p
#*





#####
#
# Net::NNTP
# 2000may09
#
#####

# «Net::NNTP»  (to ".Net::NNTP")

# (eeman "Net::NNTP")
# (find-pl5file "Net/NNTP.pm")
# (find-pl5file "Net/NNTP.pm" "=item next")
# (find-pl5file "Net/NNTP.pm" "=item newnews")
# (find-fline "~/bin/sendemail")
# (find-pl5file "5.005/Data/Dumper.pm")

# First test: get the last (?) article.

cat > /tmp/p <<'---'
  use Data::Dumper;
  sub pdump { print "\n  $_[0] =\n", Dumper($_[1]); }
  use Net::NNTP;
  $nntp = Net::NNTP->new("news.inx.com.br",
			 Debug => 1);
  $nntp->group("comp.lang.tcl");
  pdump('$nntp', $nntp);
  $msgid =
    $nntp->next();
  $art =
    $nntp->article($msgid);
  print join('', @$art);

  # Also works; this msgnum was extracted from an "Xref:" line by hand.
  #$art2 =
  #  $nntp->article(138818);
  #print join('', @$art2);

  $nntp->quit;
---
perl /tmp/p \
  |& tee ~/o



# Try to get all the articles posted in the last 24hs in a group.
# First the list... (put it in ~/o2)

# (find-es "mail" "RFCs")
# (find-fline "~/tmp/rfc977.txt" "3.8.1.  NEWNEWS")
# (find-fline "~/tmp/rfc977.txt" "The date is sent as")
# (find-pl5file "Net/NNTP.pm" "sub _timestr")
# (find-pl5file "Net/NNTP.pm" "=item newnews")
# (find-pl5file "Net/NNTP.pm" "=item date")

cat > /tmp/p <<'---'
  use Data::Dumper;sub pdump{print"\n  $_[0] =\n",Dumper($_[1]);}
  use Net::NNTP;$nntp=Net::NNTP->new("news.inx.com.br",Debug=>1);
  $date =
    $nntp->date();
  pdump('$date', $date);
  $newnews =
    $nntp->newnews( $date - 24*3600, "comp.lang.tcl");
  pdump('$newnews', $newnews);
  #
  open(O, "> $ENV{'HOME'}/o2") || die "Can't open o2";
  print O join("\n", @$newnews);
  close(O);
---
perl /tmp/p \
  |& tee ~/o

# (find-fline "~/o")
# (find-fline "~/o2")


cat > /tmp/p <<'---'
  $newnews = ["foo\n", "bar\n"];
  open(O, "> $ENV{'HOME'}/o2") || die "Can't open";
  print O join("\n", @$newnews);
  close(O);
---
perl /tmp/p
cat ~/o2




# ...and now the articles themselves, using the listing in ~/o2.
# (eeman "perlsyn" "foreach my")

rm -Rv /tmp/n/
mkdir /tmp/n/
cd /tmp/n/
cat > /tmp/p <<'---'
  use Data::Dumper;sub pdump{print"\n  $_[0] =\n",Dumper($_[1]);}
  use Net::NNTP;$nntp=Net::NNTP->new("news.inx.com.br",Debug=>1);
  @articles = split("\n", `cat ~/o2`);
  $n = 0;
  foreach $msgid (@articles) {
    $art =
      $nntp->article($msgid);
    $fname = "> _" . sprintf("%03d", $n); 
    open(O, $fname) || die "Can't open $fname"; 
    print O join('', @$art);
    close(O);
    $n++;
  }
---
perl /tmp/p

mkdir ~/tmp/tclnews
mv * ~/tmp/tclnews/ -v
cd ~/tmp/tclnews/

# (find-fline "~/tmp/tclnews/")




#####
#
# reading an entire file at once
# 2000oct02
#
#####

# «reading_a_file_at_once»  (to ".reading_a_file_at_once")
# (eeman "perlvar" "input_record_separator HANDLE EXPR")
# (eeman "perlop" "null filehandle")
#*
ls /tmp \
  | perl -e 'undef $/; print "AAAA:", <>, ":ZZZZ\n";'
#*



#####
#
# "/e" in regsub
# 2001jan15
#
#####

# «eval_in_regsub»  (to ".eval_in_regsub")
# (find-angg ".zshrc" "save-input")
# (eeman "perlop" "abc246xyz")
# (find-pl5podfile "perlop.pod" "abc246xyz")
# (find-pl5podfile "perlfunc.pod" "=item chr\n")
# (find-node "(zsh)Shell Builtin Commands" "echo")
#*
echo -ne '\r\a\n\f\t' \
  | perl -nle '
      s/[\000-\037]/"^".chr(ord($&)+64)/eg; print
    '
#*




#####
#
# filter
# 2001jul11
#
#####

# «filter»  (to ".filter")
# (eeman "1p perlfunc" "split /")
# (eeman "1p perlop" "  Quote and Quote-like Operators")
#*
# (find-angg ".zshrc" "filter")
function filter () {
  WHICH=$1 \
  perl -nle '
    if (m/;;-> (.*)/) {
      $doprint = 0;
      for $p (split(/ /, $1)) {
	for $w (split(/,/, $ENV{"WHICH"})) {
          if ($p eq $w) { $doprint = 1 }
        }
      }
    } else {
      if ($doprint) { print; }
    }
  '
}

cat > /tmp/file <<'---'
one
;;-> foo
two
;;-> bar baz
three
;;-> foo baz
four
;;-> fiv
five
---

cat /tmp/file | filter foo
cat /tmp/file | filter bar
cat /tmp/file | filter baz
cat /tmp/file | filter foo,fiv
#*





#####
#
# DB files
# 2005oct27
#
#####

# «db_files»  (to ".db_files")
# (find-man "3perl DB_File" "print the contents of the file")
# (find-man "1 perlfunc"    "tie VARIABLE,CLASSNAME,LIST")
# (find-sh "file /var/cache/man/index.db")
#*
rm -Rv /tmp/mydb/
mkdir  /tmp/mydb/
cd     /tmp/mydb/
cat > foo.pl <<'%%%'
  use warnings ;
  use strict ;
  use DB_File ;
  our (%h, $k, $v) ;

  unlink "fruit" ;
  tie %h, "DB_File", "fruit", O_RDWR|O_CREAT, 0666, $DB_HASH
      or die "Cannot open file 'fruit': $!\n";

  # Add a few key/value pairs to the file
  $h{"apple"} = "red" ;
  $h{"orange"} = "orange" ;
  $h{"banana"} = "yellow" ;
  $h{"tomato"} = "red" ;

  # Check for existence of a key
  print "Banana Exists\n\n" if $h{"banana"} ;

  # Delete a key/value pair.
  delete $h{"apple"} ;

  # print the contents of the file
  while (($k, $v) = each %h)
    { print "$k -> $v\n" }

  untie %h ;
%%%

perl foo.pl

#*
cd /tmp/mydb/
cat > bar.pl <<'%%%'
  use warnings ;
  use strict ;
  use DB_File ;
  our (%h, $k, $v) ;
  tie %h, "DB_File", "fruit", O_RDONLY, 0666, $DB_HASH
      or die "Cannot open file 'fruit': $!\n";
  # print the contents of the file
  while (($k, $v) = each %h)
    { print "$k -> $v\n" }
  untie %h ;
%%%

perl bar.pl

#*




#####
#
# eepitch-perl
# 2009jul26
#
#####

# «eepitch-perl»  (to ".eepitch-perl")
# (find-angg ".emacs" "perl")

* (eepitch-perl)
* (eepitch-kill)
* (eepitch-perl)
write("foo\n")
write "foo\n"
;
flush;
hex("40");
print hex(40);
print hex("40");
print chr(hex("40"));

h h
perl-doc perl-doc-html

# (find-status   "perl-doc")
# (find-vldifile "perl-doc.list")
# (find-udfile   "perl-doc/")
# (find-status   "perl-doc-html")
# (find-vldifile "perl-doc-html.list")
# (find-udfile   "perl-doc-html/")
# (find-man "perldebug")




#####
#
# Sepia (Simple Emacs-Perl InterAction)
# 2013jan02
#
#####

# «sepia» (to ".sepia")
# (find-available "sepia")




#####
#
# cpan-2020
# 2020jun28
#
#####

# «cpan-2020» (to ".cpan-2020")
# (find-asrootfile "/root/.cpan/")
# (find-asrootfile "/root/.cpan/CPAN/")

Autoconfiguration complete.
commit: wrote '/root/.cpan/CPAN/MyConfig.pm'
You can re-run configuration any time with 'o conf init' in the CPAN shell





# https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-02/msg00263.html

git log -p --since="2021-10-01" --author luangruo -- | perl -ne 'chomp; $line = 
$_;
if ($line =~ /^[ -]((DEFUN\s\()|[a-z]\S+\s\()/) {
    $prim = 1 if $2;
    $new = "";
    substr($line,0,1) = "-";
    $old = "$line\n";
} elsif ($old && $line =~ /^[-]/) {
    $old .= "$line\n" if $line =~ /[(),]/;
} elsif ($old && $line =~ /^\+/) {
    $new .= "$line\n" if $line =~ /[(),]/;
    if (!$prim && $new =~ /\)\s*$/ ||
        $prim && $new =~ /\d,\s*\d,\s*\d/) {
        print $old;
        print $new;
        $prim = $old = $new = "";
    }
} else {
    $prim = $old = $new = "";
}'






# (find-sh "egrep '^[qwertyuiop]+$' /usr/share/dict/words | perl -lne '/(.*)/ and print length($1), \"\\t\", $1' | sort -nr | head -n 100")
# (find-sh "egrep '^[aoeuidhtns]+$' /usr/share/dict/words | perl -lne '/(.*)/ and print length($1), \"\\t\", $1' | sort -nr | head -n 100")





/x for whitespace and comments
use re "debug"
will cause the perl regex engine to spit out lots of comments about
what it's doing
use re 'debugcolor'
perl -Mre=debugcolor -e '"hi" =~ /h([a-z]*)/'



http://search.cpan.org/dist/Perl-Tidy/bin/perltidy
http://www.csse.monash.edu.au/~damian/papers/HTML/Perligata.html

https://news.ycombinator.com/item?id=28919910 The reports of Perl's death have been greatly exaggerated (phoenixtrap.com)
https://news.ycombinator.com/item?id=33404658 The Perl Foundation will now be known as The Perl and Raku Foundation (perlfoundation.org)
https://news.ycombinator.com/item?id=36569727 Perl 5.38 (perl.org)
https://news.ycombinator.com/item?id=36650120 Perl first commit: a “replacement” for Awk and sed (github.com/perl)

https://metacpan.org/pod/criticism
https://metacpan.org/pod/Carton
https://en.wikipedia.org/wiki/Black_Perl
https://stuartsierra.com/download/perl-in-lisp-literate-full.html




#  Local Variables:
#  coding:               utf-8-unix
#  End: