Thank you very much everyone for your answers. I’ve just begun learning Perl after many years of using compiled languages such as C/C++. Although I seem to have made an elementary mistake in this case, I am very impressed at how quickly one can become productive with Perl. I am using it to do some statistical analysis in support of a few Natural Language Processing algorithms I am developing.
If you are performing more than very basic statistical analyses, you should take a look at Bundle::Math::Statistics and the modules it contains - it may save you a lot of effort.