≡ Menu


Perl developers should understand how to use complex data structures effectively. In this article, I picked the top 5 useful posts about complex data structures from perlmonks, and gave simple examples on how to use them. 1. Perl Array of Arrays The following example defines a sample perl array of arrays. @tgs = ( ['article [...]


To run various open source applications you might have to install Apache, MySQL, PHP, and Perl (or some combination of these). For those who have difficulties installing and configuring these separately, XAMPP might be helpful. XAMPP is Apache distribution that contains MySQL, PHP and Perl. You really don’t need to worry about configuring MySQL, PHP, [...]


If you are running any web based open source application that is written in perl, you should be using mod_perl with Apache instead of running it as CGI. mod_perl is way faster than running a web application using CGI. This article explains how to install mod_perl on Apache 2. First, install Apache 2, if you [...]


6 Perl File Handle Examples to Open, Read, and Write File

In this article, let us discuss how to manipulate the file handlers in Perl. 1. Typical Way of Opening a Perl File Handlers The perl example below opens a file with a bareword. This is a typical perl file open scenario. #!/usr/bin/perl open FH,"</tmp/msg"; Read Operation with Bareword file handle: #!/usr/bin/perl open FH,"</tmp/msg"; $line = [...]


Log Effectively Using Custom Perl Logger Module

For any custom written user services and processes, you should maintain a log file to view the status of the service, or to troubleshoot any issues with the services/processes. Perl CPAN offers few modules which provides the automated object interface for handling logging for services. In this article, let us write our own Perl logger [...]

{ 1 comment }

How To: Perl TCP / UDP Socket Programming using IO::Socket::INET

In this article, let us discuss how to write Perl socket programming using the inbuilt socket modules in Perl. Perl socket modules provides an object interface that makes it easier to create and use TCP / UPD sockets. This article covers the following topics: Perl example code for TCP client and server Perl example code [...]


Perl Exporter Tutorial with Examples – @EXPORT and @EXPORT_OK

Export allows to export the functions and variables of modules to user’s namespace using the standard import method. This way, we don’t need to create the objects for the modules to access it’s members. @EXPORT and @EXPORT_OK are the two main variables used during export operation. @EXPORT contains list of symbols (subroutines and variables) of [...]


How to do Perl Hash Reference and Dereference

Question: How do I reference perl hash? How do I deference perl hash? Can you explain it with a simple example? Answer: In our previous article we discussed about Perl array reference. Similar to the array, Perl hash can also be referenced by placing the ‘\’ character in front of the hash. The general form [...]