|
|
pradeep
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.
...
|
|
8 |
15,360 |
|
|
XXxxImmortalxxXX
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 |
3,544 |
|
|
pradeep
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...
|
|
6 |
9,639 |
|
 |
pradeep
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);
|
|
2 |
1,996 |
|
 |
pradeep
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 |
970 |
|
 |
pradeep
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 |
688 |
|
 |
pradeep
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...
|
07-03-2009 09:17 PM
by alfa
|
12 |
5,837 |
|
 |
pradeep
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...
|
|
1 |
1,432 |
|
 |
pradeep
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 |
4,296 |
|
 |
pradeep
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 |
1,307 |
|
|
naveen
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 |
4,343 |
|
 |
pradeep
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 |
2,154 |
|
 |
pradeep
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.
...
|
|
4 |
11,682 |
|
 |
pradeep
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...
|
|
5 |
2,965 |
|
 |
pradeep
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...
|
|
5 |
6,095 |
|
 |
pradeep
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 |
15,013 |
|
 |
pradeep
In rashida.par's Recursive function to find X to the power n (http://www.go4expert.com/forums/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...
|
|
1 |
4,750 |
|
 |
pradeep
Introduction To Hashes In Perl (http://www.go4expert.com/forums/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...
|
|
1 |
11,119 |
|
 |
pradeep
Here are a few tips & tricks which you may find useful when dealing with files/directories in Perl.
Perl Test Operators
+-------------+------------------------------------+
| Operator | Function |
+-------------+------------------------------------+
...
|
|
0 |
2,628 |
|
 |
pradeep
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 |
1,781 |