Collin Park has written an article in four parts (one, two, three, and four) titled “Why Not Python?”. I’ve read through the first couple of parts and scrolled through the rest.
In all that text that passed in front of my eyes I haven’t found the answer to the question. I guess, it wasn’t actually the question after all then.
Well, in case you read asked yourself “Why Not Python?”, I’ll give one of the possible answers. Because it is too complicated. Python might do OK as the first progarmming language for those of you who want to learn programming concepts. But if you have a problem at hand that needs solving, Perl is the way to go in most of the cases.
Example. Collin Park uses the Sudoku game solver as one of the examples. Fine task. Nice one to learn how to program too. But if you just have a Sudoku game to solve (or a few for that matter), than it would be much faster to do it in Perl. Here is how.
- Navigate your browser to search.cpan.org.
- Type in “sudoku”, choose “Modules” and press “Search CPAN”.
- With this particular example, any module from the search result can be used. With other examples, you want really want to review the module description (one line that says what module does). So, this step is, choose the one module that seems to be appropriate for your problem.
- Install chosen module, by running
cpancommand from root shell and typing in
install module::name(substitute “module::name” with the name of the module you chose in the previous step).
perldoc module::nameto see module documentation and example of used.
- Copy the code from SYNOPSIS are of documentation in your favourite editor.
- Save the file
- Run the script
Tada! You’re all done.
If it takes you more than 15 minutes, chances are – you are doing something wrong. Of course, your mileage may vary, but 15 minutes is somewhere near the lighthouse.