 |
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...
By pradeep
Last Message By PradeepKr
|
5 11,511 |
 |
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
...
By pradeep
Last Message By fazalca
|
3 11,355 |
 |
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...
By XXxxImmortalxxXX
Last Message By Fatboy12345236
|
4 10,766 |
 |
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...
By pradeep
Last Message By rai_gandalf
|
1 10,413 |
 |
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
By ungalnanban
Last Message By rahuliet2008
|
2 10,009 |
 |
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...
By pradeep
|
0 9,271 |
 |
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....
By pradeep
Last Message By oleber
|
7 8,472 |
 |
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;
By naveen
|
0 8,459 |
 |
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...
By pradeep
|
0 8,266 |
 |
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;
}
By pradeep
|
0 7,800 |
 |
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...
By naveen
|
0 7,710 |
 |
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,...
By pradeep
Last Message By shabbir
|
1 7,702 |
 |
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 =...
By naveen
Last Message By shabbir
|
1 7,603 |
 |
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...
By oleber
Last Message By shabbir
|
1 6,907 |
 |
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.
By pradeep
Last Message By #anna
|
1 6,686 |
 |
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....
By pradeep
|
0 6,641 |
 |
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...
By pradeep
Last Message By shabbir
|
2 6,577 |
 |
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...
By pradeep
|
0 6,492 |
 |
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...
By pradeep
Last Message By shabbir
|
3 6,360 |
 |
The normal idea is to have an hash table, iterate over the array and using the elements as keys.
Something like ::(
my @array = (1,5,3,7,9,1,4,5,7,6,7);
my %hash;
foreach my $element (@array) {
$hash{$element}++
}
By oleber
Last Message By pradeep
|
6 5,328 |