There's more than one way to do things  
PerlMonks 
Re: Meditations on the Nature of Code Examsby jeroenes (Priest) 
on Mar 21, 2001 at 18:06 UTC ( #66022=note: print w/ replies, xml )  Need Help?? 
I'm responding merely on your ranting about Matlab. First
a few statements:
Try to think like: The right tool for the job. Matlab is different, but not bad because it is different. Matlab is a Matrix oriented programming language, where perl is more or less item oriented (but see PDL).
I have been using perl and matlab on a daily basis for a couple of years, but only recently I ran into a situation that forced me to redo a matlabsolution in perl (or C, but for obvious reasons I choose perl). BTW, I studied chemistry myself. What struck me, is that some things can be written very smoothly in the perl way, but that some other things get very complicated when you have to release the matrix approach. It's similar like rewriting some complicated SQL (with lot's of joins and wherestatements on different columns from different tables) into perl. For the sake of the argument, let's assume that we have some data in a 5x5 matrix. In Matlab it's called 'a', and in perl it's a 2Darray '$a'. Let's assume it's in a tabdelimited text file, than you would fetch it: So far so good. Let's say I want to summate the rows (a basic starting point for statistics): If I want to summate columns: Maybe you have to see that it is easy to select rows/columns in matlab, and do some logic on it: I refuse to recode that in perl. I had to do it once, and it was really awful. But I can do it in SQL easily as well: And these are the basic things I run into daily, in collecting and further analysing data. But whenever you run into something that has to be done itemwise, Matlab solutions get uglier. For example, a running sum of an 1Darray 'b': So, whenever you stay as close to the matrix as possible, you will see that much of your coding is quite easy in Matlab, depending on the actual assignment. Cheers, Jeroen
In Section
Meditations

