2

Perl or PHP

-

Hi all I’m new to programming. Okay I am not new to it I want to START learning it! I want to design web sites with it and want to know what you think is better to learn. Would you learn Perl or would you learn PHP? Why? Please remember I’ve never programmed anything before.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
1

two dimensional array in perl

-

Hi all ,
I have a list of $a $b values which can go from (-180 — 180)

For example:
100 2
-2 44
332 9
26 -4
332 9
0 -1
———————————–
I want to creat a 2 dimentional array 361×361 and set it to zero then start recording the count of combnation $a $b the combanation of 332 and 9 appered twice on the list so the count will be 2

can i do some thing like this ?
———————–
my @a = ((0) x 361);

my @b = ((0) x 361);

my @matrix = (@a,@b)

while ($line = )
{
@record = split(/\s+/, $line);
$a = $record[0];
$b = $record[1];
@matrix [$a+180][$b+180] ++;
}

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
0

Chapter 2 – How to run Perl

-

Chapter 2 – How to run Perl

This quick guide was written towards Windows users.  Some modifications will have to be done for Linux or Mac users but this guide should still cover the basics.

Step 1:
Right click on Dekstop and select New>Text document

Step 2:
Rename the file as test.p;. PL is the Perl file extension.

Step 3:
Double click test.pl and enter the Perl codes as you see below. (start at the top of the document)

Step 4:
Click on your Start menu and click Run.  Type in cmd or command depending what version of Windows you are running.  Click enter.

Step 5:
If you are not on the Desktop, you need to navigate the command line until you’re on the desktop.

Step 6:
To run a perl script, you need to type in perl filename.  In our example, test.pl is our filename so we type in perl test.pl.  Click enter and the script should run.

VN:F [1.9.22_1171]
Rating: 8.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
0

Chapter 1 – Perl Introduction

-

Chapter 1 – Perl Introduction

What is it?
Perl was one of the first successful computer languages ever written, through its years of existence the contributors of the language have made it one of the the most robust and powerful languages available for personal or commercial use. Perl is short for Practical Extraction Report Language, because that’s what it is. It creates and extracts data on the fly with remarkable speed and efficiency.

You will often times hear the words Perl and CGI together as if they’re one and the same. It’s safe to think this, as CGI is a module built for Perl, the main difference is CGI is typically OOP (object-oriented programming) while Perl itself usually is not. CGI is short for Common Gateway Interface which is a great name because it’s Perl’s interface to work on the web.

What does it do?
Since this is one of the fastest computer languages, Perl makes a great report processing and retrieval language. You can parse hundreds of thousands of lines of code from a text file in just fractions of a second.

Some very common uses for Perl or CGI include: data extraction, encryption, contact forms, guestbooks, full ecommerce sites, web parsers and web bots, search engines, image manipulation, security, and game development.

What can’t it do?
It can do nearly anything you can think of when working in solely on your own computer (the greatest limitation is the operating system itself). You can create graphics, setup password scripts, encrypt files, track users, etc. But on the web, its only limitation is the fact it’s a server-side language and not client-side.

This means that the content created using Perl/CGI is not dynamic and all of its work is completed at the time the page loads. This is unlike JavaScript which can have content change at any given time. A simple example of this would be a contact form. The fields can’t be checked or verified on the page that just loaded, the page has to reload or redirect before Perl/CGI can process this information.

What do I need?
If you want to run Perl scripts on your own computer and you’re on Windows or Mac, you’ll need to download ActiveState Perl. You should do your best to download the latest and greatest version available.  At the time of writing this article, the latest version is 5.8.6.

To use CGI, you’ll either need your own server or a server hosted online. Your server or web host must have access to the CGI module. If it doesn’t, you will not be able to use web based Perl scripts. There are many free servers out there that do allow CGI and nearly all paid hosts will.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)