Perl Programming Tutorials

PERL Programming Tutorials And Articles
  Title / Author Replies
Views Reverse Sort Order
Working with dates is a very common feature of any application, be it a web app or a desktop one. Some people consider Perl to be a language where working with dates is hard, but basically it's quite easy if you know how to. Datetime is a common term while refering to date and time together. ...
Ceil in Perl Cieling is basically outputing the next largest integer for an given real number. ceiling(x) is the smallest integer not less than x Ways to do it in Perl, a) using our own logic my $num = 45.4; my $ceil = int($num + 0.99);
There are many ways to send email from a Perl script, one the all time popular being using sendmail. But, there are other ways of sending emails, one of which is using the module Net::SMTP.All you have to do is to include the Net::SMTP module in your script and try using the example below. ...
As the world is fast becoming aware of the benifits of XML, perl developers would also want to use XML in their CGI-Perl scripts. XML parsing seems to be one hell of a job when you look at the XML::Parser module, but XML::Simple comes to the rescue with the ease of use it brings. Installing...
Introduction CSV is a comma separated value data file is a physical ASCII file structure that contains records whose values are delimited or separated by commas. CSV is a common file type which can be imported into spreadsheet applications such as MS-Excel, database applications such as...
Introduction Usually we run various scripts like newsletter mailer, backup scripts, etc. which take quite a lot of time, making us think of some ways to make it faster. One way to make it faster is to run some operations in parallel, like sending email to 20 subscribers in parallel for the...
Introduction One of the strengths of PHP when it comes to arrays is considered to be the in_array function (, this function takes two parameters; the array and the item to be searched in the array and then returns a boolean result whether the item exists in the array....
Getting a recursive listing of all the specified directories within a specified path using FTP. We sometimes requires to calculate the number of directories or the number of files, and sometimes even the total size of files inside the specified directory. The following code is written to get the...
I am assuming from now on that you are familiar with substitution operator in perl: s///. A basic example: $str =~ s/apple/orange/; would replace the word "apple" with the word "orange". The separator "/" we used in this example can be replaced with any other non...
How often have you wanted to find out the current user's name or system group within a shell script? Or wanted to get the current process ID? Well, if you're using Perl, it's nowhere near as difficult as you might think. That's because Perl comes with a library of functions designed...
Introduction To Hashes In Perl ( Preserve Add Order Perl doesn't guarantee the order of the elements of hash, they may be in a different order everytime you access the hash. It's a much wanted, rather expected behaviour that I get my elements...
A hash is a data structure that associates keys with values. The primary operation it supports efficiently is a lookup: given a key (e.g. an employee's id), find the corresponding value (e.g. that employee's name). It works by transforming the key using a hash function into a hash, a number that is...
As Perl programmer we might want to shoot off a mail for some reason or the other, especially if we've used Perl for the web. Perl being such a powerful language, it's can do virtually anything you want to do with it. Sending a mail is a piece of cake, be it using sendmail or using SMTP. CPAN is a...
Have you ever wondered how a search engine like Google works? Well, it uses web crawlers and web spiders which “crawl” the web from one URL to all connected URLs and so on retrieving relevant data from each URL and classifying each web page according to some criteria and storing the URL and related...
Introduction May times we require to check whether a process is running or not, may be for the purpose of maintaining a lock file for a process or for some other reason. Here today we'll discuss a technique in which we can do this checking provided the process/pid being checked is checked is...
I was wondering whether its possible to write a program which acts like a proxy server in Perl, so what I figured out was anything is possible with Perl. Below is the code, try it, its wonderful. I used threads to manage multiple requests, so the program can handle multiple requests...
See the following questions. It will improve your PERL knowledge. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Question 1 How do you perform a forward declaration of a subroutine performed? Choice 1 forward sub name; Choice 2
A very common technique used by many developers is to redirect the user to another URL or the referrer URL after doing some work e.g. processing a form. In Perl all headers have to printed before any actual content is outputed. A very simple way of redirecting to another URL #!/usr/bin/perl ...
This is a password generator script that I have written. Any feedback, critique or suggestions would be much appreciated. #!/usr/bin/perl ## *************************************************************************** # # genpass v1.0 (06.2007) Password Generation Program # ...
When Perl is given a file to execute or a string as a command line option (using -e), it needs to parse the contents, check it for syntax errors, and, if all is fine, execute it. Perl makes this feature available to the programmer through the eval string form. This contrasts powerfully with...