Our VMs have Perl 5.16.3 available as part of the base linux VM. Licensed as open source under the GPL, it is most often used to develop mission critical software, and has excellent integration with markup languages such as HTML, XML, amongst others. Since it is both Object Oriented as well as procedural, it could be used within a multitude of programming projects. It includes built in database integration via its DBI module. Other than DBI, it has thousands of modules, making it one of the most extensible languages. Due to its interpreted nature, Perl is similar to Python and would be easy to understand for those familiar with Python.
Running Perl code
Perl has an interactive interpreter, which could be run by simply typing
perl -e <perl_code_goes here>. E.g. to print a number:
perl -e ‘print 10’
-e flag is simply to denote that the code is not a file, but code
itself. To run a Perl script, do the following:
Since Ivy VM’s do not allow outward connections to CPAN’s website, you would have to install perl modules using the procedure below:
- Check if
CPANis installed and configured on your VM by typing
cpaninto a terminal window: cpan
- If it asks you if CPAN needs to be configured, type
- Once it is configured, type
cpanto enter the CPAN shell
- In a browser from outside the Ivy VM, search for the proper name of the Perl module you wish to download search.cpan.org
- E.g. if you want to install the MySQL driver for Perl, type install DBD::MySQL This would start the installation of the module. Ivy is able to download modules from CPAN using this method.
* You could manually install a module from its compressed file, once you have transferred the file into Ivy. However, using the process above downloads the modules’s dependencies as well.
Verifying if a module is installed
Run the following command after installing your module :
perldoc -l DBD::mysql
(e.g. if you installed
DBD::mysql). It should output the path to the installed module.
Please visit the official Perl website for more details.