The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


PerlGSL - A Collection of Perlish Interfaces to the Gnu Scientific Library



PerlGSL defines both a namespace (with certain goals) and a distribution. The aim is to flexibly and modularly provide the GSL to Perl.

PerlGSL: The Namespace

PerlGSL is primarily a concept, a namespace in which to put Perlish interfaces to the Gnu Scientific Library. The GSL provides a large number of C routines for doing scientific/mathematical calculations. To use the GSL from Perl you need to use a glue module which interfaces Perl with the GSL. Perl/C interfaces can come in many flavors; some feel more like C (see Math::GSL) while others strive to feel more like Perl. PerlGSL is meant to be a namespace to collect such modules.

Authors are encouraged to upload your modules to the PerlGSL namespace. For consistency, please attempt to:

  • Use a functional formalism if possible

  • Think of mathematical functions as Perl closures if possible

  • Wrap your C level functions in Perl level functions for easier argument munging in the future

  • Choose your module's name with care and consideration for future authors

  • Don't use the name of the library as the name of your module. Using these names may make it hard for others to name interfaces to the same library. Unfortunately, this may be unavoidable in some cases. In other cases, the library name may be used by central modules to farm out computations to other modules. For example a PerlGSL::Integration library is planned which will smartly farm out integration to the most appropriate solver (by dimensionality and complexity).

  • Be sane

PerlGSL: The Standard Distribution

Beyond defining a namespace, the PerlGSL module is a central module for installing/loading the "Standard" PerlGSL modules. Installing PerlGSL will install all of the following modules. Loading PerlGSL does nothing, however loading with a tag (e.g. use PerlGSL ':tag';) will import certain functions from these modules; the number in square brackets indicated the PerlGSL version number that the module was added to the standard distribution. Those tags are:


loads all of the above functions.

Note also that any of the individual functions may be imported individully by name.

If you are an author and would like your module added to this central framework please file a GitHub issue.

Future Goals

  • Integrate PerlGSL with Alien to provide the GSL library via CPAN

  • Continue to add modules to the namespace and the "Stardard Distribution", eventually forming a well rounded GSL implementation.

Other Perl GSL Bindings

PerlGSL is by no means the only bindings for GSL available via CPAN. Its purpose is to feel Perlish, as such it is slower than a C-level binding set and it is only as complete as authors have provided. Other bindings have other strengths and weaknesses.

  • PDL::GSL - PDL is a C-level matrix-like sublanguage for Perl. It is in the vein of MatLab or IDL. It has bindings to many of the GSL libraries. It is fast, but only as Perlish as PDL is itself.

  • Math::GSL - This set of bindings is generated by SWIG; it is therefore ostensibly complete, though this is only partially true. Many modules will still need some massaging before they are functional. Even those that are may feel more like C than Perl.



Joel Berger, <>


Copyright (C) 2012 by Joel Berger

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The GSL is licensed under the terms of the GNU General Public License (GPL)