I've frequently read that knowledge of Perl or Python complements SAS or R, and seen that Perl is a desirable language in job advertisements.

Can anyone clarify this a bit more? Is Perl limited to text mining & database updates or does it have other applications in the statistics world? Thanks!

  • 3
    $\begingroup$ Since Python was discussed enough on CV, I took the liberty to focus this Q on Perl. $\endgroup$
    – user88
    Sep 7, 2012 at 17:28
  • 1
    $\begingroup$ This doesn't seem like a CrossValidated question (it's about computing rather than statistics), but I'm not quite sure where it does belong ... $\endgroup$
    – Ben Bolker
    Sep 7, 2012 at 19:11
  • 2
    $\begingroup$ Hopefully, @Karl (website) or Vincent Zoonekynd (website) will come to rescue here; otherwise, check this JSS article: Using Perl for Statistics: Data Processing and Statistical Computing. $\endgroup$
    – chl
    Sep 7, 2012 at 20:11
  • $\begingroup$ I belong to the "use Perl to prepare data to make it easily readable for R" group. $\endgroup$ Feb 14, 2013 at 11:13
  • $\begingroup$ Perl can be used to accomplish all sorts of tasks - it's not only about regular expressions. For example, CPAN, which is akin to CRAN for R, contains a whole host of perl modules. Basically, you can think of perl modules as R packages. $\endgroup$ Feb 8, 2014 at 15:44

2 Answers 2


Perl and Python have several modules for statistics. While they can accomplish a number of common tasks, their scope is certainly limited compared to a specialized language like R. I can think of two situations where a programmer might choose to handle statistics in Perl/Python:

  • other features of Perl (eg, data munging) are needed and the statistical needs are light
  • the programmer doesn't know SAS/R and the other tools work "well enough"

Assuming some knowledge of R, it's pretty easy to insert some into Perl or Python so it's quite possible to use both for their respective strengths.

  • 2
    $\begingroup$ I once used python to fit a specialized GLM with $> 500$ million observations and an a priori unknown number of parameters. It would have been impossible to do in R, in a number of respects, and the statistical needs were far from light, indeed they were the integral aim of the utility. :-) $\endgroup$
    – cardinal
    Feb 14, 2013 at 3:25
  • $\begingroup$ Thank you ingelkott & cardinal. So with truly vast datasets, would it be safe to say that manually programming your model in Python (or C++ for that matter) is desirable vs using canned procedures in SAS, Stata or R? $\endgroup$
    – RobertF
    Feb 15, 2013 at 21:29
  • $\begingroup$ Can't say that this is generally true but it does happen to match my limited experience with even modest (100K) datasets in R ... though that might be partly due to the fact that I'm much more comfortable with Perl than R. $\endgroup$
    – igelkott
    Feb 16, 2013 at 0:26

I use R as my basic language and enviroment. When R isn't fast enough I recourse to Perl and the Perl Data Language. Occasionally I code things in C linking with LAPACK to have a full speed alternative.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.