# Perl advantages in data management/statistical analysis?

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!

• Since Python was discussed enough on CV, I took the liberty to focus this Q on Perl.
– user88
Sep 7 '12 at 17:28
• 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 ... Sep 7 '12 at 19:11
• 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.
– chl
Sep 7 '12 at 20:11
• I belong to the "use Perl to prepare data to make it easily readable for R" group. Feb 14 '13 at 11:13
• 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. Feb 8 '14 at 15:44

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.

• 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. :-) Feb 14 '13 at 3:25
• 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? Feb 15 '13 at 21:29
• 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. Feb 16 '13 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.