- Joined
- Mar 19, 2007
- Sythe Gold
- 0
- Messages
- 1,084
- Age
- 33
Well, I'm currently learning Perl too, so it might not be up to par with other Perl guides.
The basics of Perl!
Chapters:
Chapter 1: Starting off
Chapter 2: Your first Perl program
Chapter 3: Numbers + Strings
Chapter 4: Variables
More coming soon.
Chapter 1:
Alright, now you might be asking "what excatly is Perl?". Well since I can't be annoyed typing up something fancy and accurate, I'll get it from Wiki or something.
http://en.wikipedia.org/wiki/Perl
Now we'll need to download Perl, which can be found here.
*Note you'll need Winrar to open it.
Alright now that everything is downloaded and set up, you might be wondering how to run a script. Well I'll tell you how!
Now that we have that squared away I'll show you how to make your first program.
Chapter 2:
Now to being open up notepad and at the top put:
Now hit enter a few times and put in
now save it as 1.pl, and save it in C:\Perl\bin
now run it, and if you're successful you should see Hello world! in your command promp. Great job! Now move on to the next chapter!
Chapter 3:
Now numbers in Perl aren't like regular numbers. Instead of having 5,000 or 5 000 in Perl you'll have to put it as 5000.
Strings are lines of text either with single quotes or double.
If the line is in double quotes it'll be read and you can put in commands in the quotes such as /n to put it on two different lines.
If it's in single quotes it'll be read as just / and n nothing special.
Chapter 4:
Now we're on our way.
There are 3 types of variables:
Scalars
Arrays
Hashes
Scalars:
Scalars begin with the dollar sign:
For example if I were to use a scalar I'd put:
You can use different letters and words instead of "r".
For example I could do this:
It'll show up as this:
My favorite food and drink is Tomato and Mountain Dew
Instead of print you may also use say. Print starts new lines automatically, and with say you have to add them manually.
You can also do math problems with Scalars.
The symbols are
Of course you know what the first four symbols are, but what is the last one?
Well what that does is combines the number, for example if I put 5 . 6 it would equal 56, pretty cool eh?
Alright I'll wrap it up for now as I'm getting tired of typing :[ I'll edit it with more information over time.
The basics of Perl!
Chapters:
Chapter 1: Starting off
Chapter 2: Your first Perl program
Chapter 3: Numbers + Strings
Chapter 4: Variables
More coming soon.
Chapter 1:
Alright, now you might be asking "what excatly is Perl?". Well since I can't be annoyed typing up something fancy and accurate, I'll get it from Wiki or something.
In computer programming, Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall, a linguist working as a systems administrator for NASA, in 1987, as a general purpose Unix scripting language to make report processing easier.[1][2]Since then, it has undergone many changes and revisions and became widely popular among programmers. Larry Wall continues to oversee development of the core language, and its newest version, Perl 6.
http://en.wikipedia.org/wiki/Perl
Now we'll need to download Perl, which can be found here.
*Note you'll need Winrar to open it.
Alright now that everything is downloaded and set up, you might be wondering how to run a script. Well I'll tell you how!
Code:
Go to Run>type in CMD and hit enter> type in "c:/perl/bin/scriptname.pl"
Chapter 2:
Now to being open up notepad and at the top put:
Code:
#!/usr/bin/perl
Now hit enter a few times and put in
Code:
print 'Hello world!';
now save it as 1.pl, and save it in C:\Perl\bin
now run it, and if you're successful you should see Hello world! in your command promp. Great job! Now move on to the next chapter!
Chapter 3:
Now numbers in Perl aren't like regular numbers. Instead of having 5,000 or 5 000 in Perl you'll have to put it as 5000.
Strings are lines of text either with single quotes or double.
If the line is in double quotes it'll be read and you can put in commands in the quotes such as /n to put it on two different lines.
If it's in single quotes it'll be read as just / and n nothing special.
Chapter 4:
Now we're on our way.
There are 3 types of variables:
Scalars
Arrays
Hashes
Scalars:
Scalars begin with the dollar sign:
For example if I were to use a scalar I'd put:
Code:
my $r = 7;
For example I could do this:
Code:
my $food = "Tomato";
my $drink = "Mountain Dew";
print "My favorite food and drink is $food and $drink;
It'll show up as this:
My favorite food and drink is Tomato and Mountain Dew
Instead of print you may also use say. Print starts new lines automatically, and with say you have to add them manually.
You can also do math problems with Scalars.
The symbols are
+
-
/
*
.
Of course you know what the first four symbols are, but what is the last one?
Well what that does is combines the number, for example if I put 5 . 6 it would equal 56, pretty cool eh?
Alright I'll wrap it up for now as I'm getting tired of typing :[ I'll edit it with more information over time.













