Perl Programming Tutorials

PERL Programming Tutorials And Articles
  Title / Author Replies
Views Reverse Sort Order
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}++ }
6
5,911
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
5,405
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,000
Introduction Perl is renowned for being a language where you can express complicated commands in a very small amount of space. We'll start with the simplest of programs, which simply reads in characters from the keyboard and repeats them back to the console. In Perl you might write this...
1
4,896
Here are a few tips & tricks which you may find useful when dealing with files/directories in Perl. Perl Test Operators +-------------+------------------------------------+ | Operator | Function | +-------------+------------------------------------+ ...
0
4,635
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
4,557
Different Operating Systems use different characters as their path separator when specifying directory and file paths: foo/bar/baz # *nix uses a / foo\bar\baz # Win32 uses a \ foo:bar:baz # Mac OS 9 uses a : foo/bar/baz # Mac OS X uses a / (usually!) In Perl you can generally...
0
4,064
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
3,830
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,784
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,677
At some point while writing a CGI script in Perl, many newbies have needed to print all the environment varibles in Perl, sometimes for debugging or for the sake of curiosity. Well, here is the code to print all the CGI environment variables. #!/usr/bin/perl print "Content-type:...
1
3,660
Most modern day websites take inputs from user in the form of comments, reviews, PMs etc. and it's needed to control the HTML tags in the users' content to prevent XSS attacks, spamming with URLs, embedding videos - which might attract copyright problems - and similar problems. Many sites list...
2
3,428
List of common file extensions and their corresponding MIME types in a hash, which can be quite use at times. %mime_types = {'.ai','application/postscript', '.aif','audio/x-aiff', '.aifc','audio/x-aiff', '.aiff','audio/x-aiff', '.asc','text/plain', '.au','audio/basic', ...
1
3,064
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,830