Perl Programming Tutorials

PERL Programming Tutorials And Articles
  Title / Author Replies
Views Reverse Sort Order
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...
7
14,785
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
2
14,593
Introduction We all write programs to run on the terminal to do jobs that take time, like processing logs, sending out newsletter, etc. To know the progress of our task we print some messages to know our program is running well and doing its job. But wouldn't it be nice if we could add a...
5
13,965
Introduction IRC is a very easy protocol to communicate with once you get the basics. I'll be showing how to create a 'bot' (=robot) in the well-known scripting language Perl. All the commands sent to the server can also be ported to any other programming or scripting language. I will not go...
4
12,899
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
12,207
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,745
JSON has become a popular data representation format, and can been seen as the successor of XML which used to be the most popular format used for data exchange between systems. Notable examples of JSON being used for data representation are Facebook Graph API & Flickr API, amongst many others....
0
10,007
Hi friends, This is a very simple example demonstrating how to implement cookies in perl. This File (set.pl) sets the cookie- #!/usr/bin/perl use CGI qw(:standard); use CGI::Cookie;
0
9,812
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,582
When your script writes to a new file, you probably want it to create a new and unique name for the new file, one that doesn't conflict with any existing files, which would be overwritten. One way to create a new file name that's unique is to incorporate the process id and the time into the name....
7
9,551
How to direct a browser to display a different HTML page This is actually very simple to do in a CGI script. Instead of the usual header Content-type: text/html #make your script print this Location: URL to display #Don't forget the blank line afterwards. -or- print...
0
9,080
Many times we need to check whether a number is negative or not, here is a very simple subroutine to do that. sub isNegative { my($checkValue) = @_; if(abs($checkValue) != $checkValue) { # the value is negative return 1; }
0
9,021
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,556
Introduction Pagination is a very basic requirement of a web application, in this article we'll see how to implement pagination easily using the Perl module Data::Pageset. Basically there are two types of pagination, Jumping and Sliding. In the jumping type the current page jumps from the...
2
8,528
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,407
Well this has been out for quite sometime now, so i thought to share with all out here. Heres a PERL script demonstrating how to retrieve the data from the Google Suggest Drop Down Autocomplete and use it as you please! This was developed by John Bokma , but worked in command line only. So i have...
0
8,318
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
8,068
Introduction If you're like most people, you probably have a bunch of MP3s scattered around your hard disk. And if you're like most people, you probably also have on your to-do list a plan to inspect and catalog them so that you know exactly what you're listening to. It's just that you...
0
7,560
Everyone knows that Perl is extremely fast when it comes to handling regular expressions and text processing... but have you ever wondered how fast is extremely fast? Well, one of the toys us big kids have at our disposal is the Perl Benchmark module, which lets you test the speed of a Perl script....
0
7,507
After allot of searches like 'find . -type f -exec grep main {} -H \;' I implemented a small program :eek:. ;) This program uses the normal 'file' shell command to check if a file is a text file. ;) Ignores files inside /CVS/. They are there, but who cares? ;) Clearly...
1
7,490