Perl Programming Tutorials

PERL Programming Tutorials And Articles
  Title / Author Replies
Views
Introcution Amazon's S3 is a really amazing service, where you can store unlimited amount of data at a very cheap rate, and the service being really reliable at the same time. Signing up for the service is really easy, you are charged a very low rate only for what you use, you can read more about...
1
4,893
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...
12
18,051
Read An Entire File All At Once At times we need to read the contents of a file all at once, instead of reading line by line, or reading the contents line-wise into an array, here's how we can read the contents of a file into a scalar as text. open FILE, '</tmp/page.html' or die $!;...
3
14,463
Introduction Sanitizing HTML is just removing unwanted HTML elements from any inputted HTML code, it does not validate HTML code. We all have seen many sites which allow you to post comments using only a few HTML elements like <a>, <b>, <i> etc. the other HTML tags are automatically removed,...
1
9,145
Hi, Perl has been very famous for providing with very small but very useful programs, especially for the web. Hit Counters are one of such domains. Here is a small perl code to implement a basic hit counter in a web page #!/usr/bin/perl -wT print "Content-type:text/html\n\n"; $log =...
1
8,320
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 ...
3
13,975
Introduction POP3 stands for Post Office Protocol version 3, it's application layer Internet Protocol used by various desktop email clients, and web-based email services to fetch email from a remote server over a TCP/IP connection. Until sometime back POP3 was the de facto standard for email...
0
14,698
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...
0
39,085
In rashida.par's Recursive function to find X to the power n (http://www.go4expert.com/showthread.php?t=9307) I see that she intelligently used recursion to find the power of x to n. So, I was wondering whether we can do this iteratively also, I always do that - trying to find a iterative solution...
1
11,684
Introduction To Hashes In Perl (http://www.go4expert.com/showthread.php?t=8518) 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...
1
23,971
Here are a few tips & tricks which you may find useful when dealing with files/directories in Perl. Perl Test Operators +-------------+------------------------------------+ | Operator | Function | +-------------+------------------------------------+ ...
0
4,770
Introduction Templating, you can say is a way to separate the business logic from the presentation logic. Most of the world's we application developers use either embeded scripting languages like PHP, JSP, ASP etc. while other use print statments in the scripting languages to output their...
0
3,824
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...
1
32,155
Introduction One of the strengths of PHP when it comes to arrays is considered to be the in_array function (http://php.net/in_array), 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....
4
31,400
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...
3
22,618
Showing a page process time in the page footer is a common thing in many sites, some sites even take it forward by showing DB query time and processing time separately. In this tip, we'll see how to show page process time in perl. For this purpose we'll require the perl module Time::HiRes...
0
5,124
While modern browsers will work around many syntax problems in your HTML, if you want to ensure consistent pages across multiple browsers, it's a good idea to check the syntax. That's where HTML::Lint comes in. We'll show you how to use this powerful syntax-checking tool. Modern browsers...
3
7,678
Many times we require to output the time difference between two dates/time in human readable form like '5 minutes 18 seconds'... Writing a whole subroutine to perform the same can be tiresome and messy, I've written a small subroutine which uses Perl's gmtime function to achieve the same. sub...
0
10,368
There is a function ucwords() in PHP which capitalizes the first letter of each word. <? $str = "programming forums"; $str = ucwords($str); // now $str = "Programming Forums" ?> I have written a sub-routine in Perl, which gives the same functionality.
1
8,038
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...
0
26,304