|
 |
shree
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 |
5,205 |
|
 |
oleber
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}++
}
|
|
4 |
2,347 |
|
 |
gotroot
For my first thread i will post my new twitter bot/rat.
This will only work on linux and possibly mac
Its more of a funny prank than a rat, but it can be used for malicious purposes.
You need to get your victim to open the .pl file on their computer and leave it open, if your using this on...
|
|
7 |
967 |
|
 |
oleber
Many programs use the STDOUT to produce some normal output and the STDERR to show the errors. I'm actually working with the g++ that do this and a question appeared.
Wouldn't be nice to see it with different colors?
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open3;
|
|
2 |
2,747 |
|
 |
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.
...
|
|
5 |
30,009 |
|
|
pradeep
As the world is fast becoming aware of the benifits of XML, perl developers would also want to use XML in their CGI-Perl scripts. XML parsing seems to be one hell of a job when you look at the XML::Parser module, but XML::Simple comes to the rescue with the ease of use it brings.
Installing...
|
|
4 |
14,109 |
|
 |
ungalnanban
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
|
|
1 |
2,003 |
|
|
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.
...
|
|
9 |
23,742 |
|
 |
pradeep
How often have you wanted to find out the current user's name or system group within a shell script? Or wanted to get the current process ID?
Well, if you're using Perl, it's nowhere near as difficult as you might think. That's because Perl comes with a library of functions designed...
|
|
1 |
14,446 |
|
|
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 |
5,117 |
|
|
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 |
13,448 |
|
 |
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 |
9,817 |
|
 |
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 |
2,097 |
|
 |
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 |
1,475 |
|
 |
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 08:17 PM
by alfa
|
12 |
8,286 |
|
 |
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 |
3,043 |
|
 |
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 |
5,807 |
|
 |
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 |
2,702 |
|
|
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 |
5,414 |
|
 |
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 |
3,264 |