Thursday, 5 Decemberby David Farrell
Learn about the tools Jeffrey uses to code in Perl, upcoming Stratopan features and more!
More from Perltricks
Wednesday, 11 Decemberby David Farrell
Learn when and how to use this classic "gang of four" code pattern
Monday, 11 Novemberby David Farrell
Roles are a label for a set of methods that a class provides. Similar to traits in Smalltalk or an interface in Java, adding a Perl role to a class is like adding a guarantee that the class will implement that role's API. Roles are an alternative to inheritance; instead of extending a class hierarchy through subclassing, a programmer composes a class using roles for what the class does. This article describes how by using the Role::Tiny module you can imbue native Perl object oriented code with roles.
Monday, 4 Novemberby David Farrell
The behavior of the modulo operator ("%") can catch programmers by surprise as it is often misunderstood to provide the remainder of an arithmetic division operation. This article reviews the modulo operator behavior and provides an arithmetic division solution.
Sunday, 27 Octoberby David Farrell
STDOUT is the Perl filehandle for printing standard output. Unless a filehandle is specified, all standard printed output in Perl will go to the terminal. Because STDOUT is just a global variable, it can be redirected and restored. Want to implement logging on a program without changing every print statement in the source code? Want to capture the standard output of a perl CRON job? Read on.
Sunday, 20 Octoberby David Farrell
CPAN mirrors are online repositories which host or "mirror" the Perl module distributions on CPAN. There are hundreds of CPAN mirrors dispersed throughout the World. When the CPAN program is run for the first time on a machine, it will configure the CPAN mirror list to use for checking for new versions of modules and downloading Perl distributions. All CPAN mirrors are not created equally though: the distribution list's age, speed and the geographic location vary from mirror to mirror and so you may want to re-configure your local CPAN mirror list to suit your needs. This article describes how to find CPAN mirrors and edit the local CPAN mirror configuration.
Friday, 11 Octoberby David Farrell
Cron is a job scheduling program available on UNIX-like platforms. Most system commands can be scheduled including the execution of Perl programs. Once a job is setup, cron will run it as scheduled even if the user is not logged in, which can be a great way to automate sysadmin tasks or repetitive jobs. This article describes how to run Perl scripts with cron.
Thursday, 3 Octoberby David Farrell
Perl's split function has a useful feature that will split a string into characters. This works by supplying an empty regex pattern ("//") to the split function. This can be used to easily split a word into an array of letters, for example:
Sunday, 29 Septemberby David Farrell
Friday, 27 Septemberby David Farrell
Most Perl programmers know they can find out the current Perl version by typing "perl -v" as the command line: