Why full closure support makes Perl great for science

Part of the reason I love Perl is that it has full closures. It makes it really easy for my scientist brain to think of code references as equations. This is why I try to make my scientific software think this way too; PerlGSL is built on this concept. Its especially fun when this allows me to nest functionality to get even more complex behavior.

In this following example I find the Gaussian width needed so that the integral over it on a certain range has a particular value. Yes this is an easier example, but if the function f were more complex, this code would be no worse.