These days it is not very often that a new and exciting Perl book comes along. That's why I was very excited when my Amazon.co.uk box arrived by post the other day.
I gleefully ripped the cardboard box open and held in my very own hands the recently released Effective Perl Programming, 2nd edition. Twice the thickness of the first edition and jam-packed with even more useful information.
This is a fantastic read which covers just about every aspect of Perl needed to program like the pros. Myself having had quite some experience with Perl was pleasantly surprised to learn new and interesting tidbits and other gems of information. Since having already read the book from cover to cover a couple times, I now keep it close at hand for reference purposes.
This wonderful book can be useful for beginners although it's pretty detailed and technical at times, but it's real use I believe is for experienced folks like myself who want to refresh their memories, extend their horizons, and recharge their enthusiasm for exploring new and possibly dangerous territories.
Here's an example of one of those one-liner gems, see if you can figure out what it does:
@a[ map { $_ * 2 + 1, $_ * 2 } 0 .. ( $#a / 2 ) ] = @a
From Chapter 2, Item 17 we find the following quote which appropriately summarizes one of the important philosophies: Perl is a "human" language in that it has a context-dependent syntax.
Finally, here are some other interesting places you might want to explore:
I can recommend you get the book also. Have fun.
I'm not sure I'd necessarily have picked that particular line of code as the one exemplar of the entire book - perhaps something a little more immediately recognisable? ;)
Well, although that one-liner might not be easily recognizable, it does give one a sense of the magical qualities that Perl has to offer.
and in Perl 6 you would write:
@a .= map( {$^b, $^a} );
Well, how about then the inline dereferencing of an array reference into a local array like this:
is that a better example then?