Spoilers...


The basic scheme is to extract the phrase "The Perl Journal" from one of the
FAQ .pod files.  These files are installed if you build perl with
"./configure -d" followed by "make install", so I believe this entry
satisfies rule 2.  Some prebuilt packaged binary versions appear to omit
them, in which case this program will wait for you to type the file.

Anyhow, here's a more detailed explanation:

First we interate through @INC using map, each entry has a / appended and
any/all '0' characters are replaced with nul ("\0"):

$_.=q=/==>s(0)(\0)g

The $x is set to a subroutine ref.  This sub takes @_, set $x to the first
element and joins the last two elements together in reverse order with "pod"
between, and also joins pod on the end (since q,, is just another way of
saying '').

The we prepend "\n0/\n\nperl\nfaq\n2.0\n\n" to the start of $_.  The /x option
to the s/// doesn't do anything useful, though you might expect it to.

Then we split $_ at '0' to give:

@_=("\n", "/\n\nperl\nfaq\n2.", "\n\n".<element of @INC with '0' -> "\0">.'/');

We then call the subroutine referenced by $x, which returns:

"\n\n". <element of @INC with '0' -> "\0"> . "/pod/\n\nperl\nfaq\n2.pod"

The subroutine also sets $x to the first element of @_, which is "\n".

The we globally replace $x with '', and change "\0" back to '0' to give:

$_ = <element of @INC> . "/pod/perlfaq2.pod"

The if this file exists, we pass it back to map to add it to @ARGV.
Otherwise we pass back qw:: which is just () in disguise.

Once that's taken care of, we iterate over all the lines in any files which
match.  If a line contain "azi", we skip the next line and read the one
after into $#.  Any whitespace is replace by $x (i.e. "\n") and then we
print out the line up to the first "is".

This catches the lines:

  =head2 Perl in Magazines

  The Perl Journal is the first and only magazine dedicated to Perl.

And prints out the required phrase.

Olly Betts <olly@muscat.com>
