• Log in or sign up for an account here: https://www.sythe.org/login

Perl Education 2

Hax4You

Apprentice
Joined
Feb 2, 2007
Sythe Gold
0
Messages
741
Location
Dirty Jersey
Perl Education 2
Part 2 of Perl Ed​

Ok, well this is basically the same.

Meaning, all of the basics. I'll get into more advance another day.


Numero Uno!

How to create Programs with Perl using Statements.:

Now, most Perl statements will go with something like this:

- Testing "if this and that is true, then do whatever"
- Loop *See in Perl Ed 1* "Keep doing this until I say to stop bitch"
- Straight-Forward "Fart on Six"

The most often seen in Perl is Straight Forward (AKA direct-action)

This is what one script using "Direct-Action" may look like:

Code:
  open(INFILE, $FileName) or die "The file $FileName could"  .
      " not be found .\n" ;
      $LineCount = $LineCount + 1;# SIMPLE PART (YAY!)

In that *Example, the actions that will be done are open,die and the =. = Operator will be used plenty more times in Perl. What it is usually called is the assignment operator.

The assignment Operator means:
Set the variable on the of the = to the other side of the =

------------------------------------------------------------------------


Ending Statements of Perl:

The way Perl can tell when a statement ends and begins is by using the ; (Semi-Colon)

This statement ends with a ; :
Code:
$CharCount = 0

There is also something neat with Perl. Some scripts cannot fit more that one statement on a line, but Perl can :)

Like:
$LineCount = 0;
$CharCount = 0;
$WordCount = 0;

Can go all into one line:

Code:
$LineCount = 0; $CharCount = 0; $WordCount = 0;

If any of you know your text editors, the *;* will act like a line break.

Alright, well thats it for the second Perl Ed, soon (Hopefully) I will put up a third Perl Ed :D.
 
Runescape Gamblingrunescape gambling
Back
Top