So I went on record recently at a Game Day as saying that I saw no reason to use Perl in modern times - that Perl had been supplanted by Python or Ruby. After spending all day yesterday getting my head back into "Perl mode" - I've got both the Llama and Camel open on my desk right now, I'd like to amend my statement. Amongst the many perfectly valid reasons to use Perl you might end up needing a CPAN library to get something done. If the Irony Gods are listening I'm sorry and I'll try not to tempt you again!
Perl's syntax is twisted, and it's made even worse by my insistence on use strict; And of course everything I wanted to do was crazy syntactic juju. "OK, so we've got a reference to a hash of arrays of hashes. And what we want to do is iterate through one of the arrays, and store each hash in a DIFFERENT array, in a different order." You can make that work in one compact foreach although Perl will complain about using a hash value as an array index, but it looks ridiculous. At one point I seriously wrote $rows[%{$item}->{sequence}] = {$item}; And that made sense. And it still does this morning, but give me six months of non-Perling and it will be gibberish. And don't get me started on the fact that you don't declare $rows, but really declare @rows (and in fact you can declare $rows - which will bear no relation to $rows[0], which any sane language would write as @rows[0] anyway). I also quite enjoy the fact that the "reference to a hash of arrays of hashes" came out of a library that calls itself (with a straight face) "XML::Simple". What could be simpler really?
So yeah. All these because the Ruby port of the WriteSpreadsheet module writes out Excel 95, and I need Excel 2000 format. So I also blame Excel.
technorati tags:Perl, programming, Excel