≡ Menu

Perl

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. The following example defines a sample perl array of arrays. @tgs = ( ['article series', 'sed & awk', 'troubleshooting', [...]

{ 4 comments }

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, [...]

{ 7 comments }

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 [...]

{ 3 comments }

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. 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 = <FH>; print $line; Write Operation with the Bareword file [...]

{ 6 comments }

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 [...]

{ 10 comments }

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 [...]

{ 11 comments }

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 [...]

{ 5 comments }