Perl Programming Tutorials

PERL Programming Tutorials And Articles
  Title / Author Replies
Views
Connect to a MySQL server using Perl. In order to do that you'll have to use the DBI module in Perl. Below you will find an example code. #!/usr/local/ActivePerl-5.6/bin/perl -- print "Content-type: text/html\n\n"; print "<html><head><title>Database Test Page</title></head><body...
0
2,944
Below is a small Perl code that Shows all the environment variables of the Server on which it is run. #!/usr/bin/perl print "Content-type: text/html\n\n"; print "<tt>\n"; foreach $key (sort keys(%ENV)) { print "$key = $ENV{$key}<p>";
0
3,937
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,240
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,415
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,415
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,465
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,485
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,209
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,835
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,688
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
24,092
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,896
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,328
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
14,500