Register Now for O'Reilly Open Source Convention

More fun with the diamond operator

In The double diamond, a more secure <>, I showed how the diamond operator treated some characters as special when it tried to open the filenames in @ARGV. I used a file name that ended with a | to read the output for an external command.

Thinking about it more, I realized the problem is even worse. Opening an external command to read the output might even be useful. What if I start the filename with > to open a file for writing, but not only writing, to truncate it to? » Read more…

The double diamond, a more secure <>

We’ve had the three argument open since Perl 5.6. This allows us to separate the way we want to interact with the file from the filename. There’s a place where we don’t get to choose, but Perl 5.22 might introduce a new operator to handle that. » Read more…

The Data::Dumper stack smash (fixed)

Problems with data serializers was a major change to Mastering Perl. The Storable issue with malformed inputs was known for a long time but nobody much cared about it. Now it’s Data::Dumper‘s turn. » Read more…

Support Mastering Perl at the Swiss Perl Workshop

If you’ve enjoyed this website, you have the chance to show your support and to help the global Perl community.

The organizers of the 2014 Swiss Perl Workshop are also trying to organize the Perl community in Switzerland. As part of that, we are running a Kickstarter campaign to fund a Mastering Perl class while I’m there. » Read more…

Examining Quicksort

Earlier this year, Emma Howson posted a nice explanation of how Perl sorts a list. In short, Perl used to use quicksort and now uses mergesort. She then shows how each of those works.

I’ve never bothered to explain those in the Learning Perl class. I don’t even mention that there are different sort types or that the sort module lets you control which one you want to use. But, as someone on the path to mastery, you need to think deeply about things that you normally take for granted (and Perl lets us do some much of that). » Read more…

Sub::Install has a nice interface

I didn’t mention Sub::Install in the “Dynamic Subroutines” (or maybe the Symbol Table chapter. It was worth a mention (but only that). I show readers how to define subroutines in other packages (or even the current one, I guess) by assigning to a type glob: » Read more…

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: » Read more…

Naming anonymous subroutines

In the “Dynamic Subroutines” chapter, I considered adding the undocumented __ANON__ trick to give anonymous subroutines names. ysth described this in Permonks in 2003 in Named anonymous subs and later showed up in Perl Hacks #57. Although it’s undocumented, several modules use the trick. » Read more…

Mastering Perl Kindle screen shots

Catalin Ciurea (CATALIN on CPAN) sent in some pictures to show what Mastering Perl looks like on a Kindle, although he doesn’t specify which device it is. It’s one of the less sophisticated ones, but I’m surprised that it looks as good as it does. I knew the body text would be find, but it looks like the code comes out nicely too. Curiously, the book is measured in time, and it looks like he’s taking longer and longer to get through it as he progresses! » Read more…

Mastering Perl Kindle version

You can read Mastering Perl on your Kindle now. The print edition should be in the warehouses in a couple of weeks.

I don’t have a Kindle so I don’t know how the book looks in it. I don’t have much hope for the older Kindles, but what about the new Fires? Send me a screenshot if you’d like me to see what you see!

7ads6x98y