Download most Mastering Perl programs

The Mastering Perl Downloads page now has the named programs I’ve extracted from the book sources. This comprises most of the programs that you can run to do something, rather than all the code segments—many of which are fragments.

I wrote the book as Pod, then converted to DocBook. Despite all the advice we give people about parsing XML properly, I did the thing we tend to tell people not to do:

my $data = do { local( @ARGV, $/ ) = $file; <> };

my @programs = $data =~ m{
	
	(.*?)
	
	}sxg;

Most of the interesting programs in Mastering Perl have a shebang line and a following comment to give the program a name, such as:

#!/usr/bin/perl
# nested_show_matches.pl

This makes it easy to name the files once I extract them.

Curiously, I found a mistake I made in the Advanced Regular Expression chapter. In the last days, I had to make some corrections to a few programs. When I added the new versions of the book, I forgot to remove the actual shebang I was using. In those programs, two shebangs show up:

#!/usr/local/perls/perl-5.18.1/bin/perl
#!/usr/bin/perl

I guess you get double perl action for your money in those programs.