.:: Welcome To My Personal Blog ::.

Tuesday, March 8, 2011

Web designing - HTML Tutorial - 5

Paragraph Tag (<p>, </p>) :
We may need to create paragraph while designing web page. We can do it by using "<p>" tag.The starting tag will be "<p>" and the ending tag will be "</p>". If we forget to use the ending tag, the browser may display the paragraph erroneously. But fortunately, most browsers can display paragraph correctly even if we forget to use the ending tag ("</p>"). Forgetting to use the tag is not a good practice.

Saturday, March 5, 2011

Beginner's Guide To Travel With Perl - Part 8

Function

So, what will be the next? It’s function. In Perl, functions have another name “Subroutines”. It’s almost easy like other programming languages. Let’s see some examples:

Example1:


use strict;
sub pr { #description of subroutine
print "inside the subroutine\n";
}
print "subroutine example\n";
print "calling it\n";
&pr; #calling subroutine, only “pr” also works here
print "The End\n";

Beginner's Guide To Travel With Perl - Part 7

Input/Output from user

Let’s see how to take input from user. It can easily be done by . stands for standard input. It can be abbreviated by using simple <>. By declaring a scalar variable and setting it equal to we set the variable equal to whatever will be typed by our user at the command prompt. But here’s a little problem. When we give input in command prompt and press enter, the variable also takes the newline character with the input. As a result an extra newline is printed while printing the value of the variable. To get rid of this problem we can use chomp() function. This function simply removes any erroneous line breaks and spacing from the end of our string.

Beginner's Guide To Travel With Perl - Part 6

Built-in Operators

Arithmetic Operator :

+ Addition
- Subtraction
* Multiplication
/ Division


Beginner's Guide To Travel With Perl - Part 5

Scope - Something Important

It’s time to say something important now. We can declare any variable in two ways – First is writing variable name with $ sign and assigning a value to it. The second is to write variable name $ sign and adding “my” before it when the variable is used first time.

Beginner's Guide To Travel With Perl - Part 4

Branching

We may have to use condition in some programs. The syntax will be the following:
if ( condition ) {
...
} elsif ( other condition ) {
...
} else {
...
}

Beginner's Guide To Travel With Perl - Part 3

Variables

It’s time to say something about variables now. Perl has three types of variables: scalars, arrays and hashes. Let’s think of them as “things”, “lists” and “dictionaries”. All variable names are a punctuation character, a letter or underscore, and one or more alphanumeric characters or underscores in Perl.

Beginner's Guide To Travel With Perl - Part 2

Strings

Let’s say something about strings. A string is a group of characters between two single quotes or two double quotes. If the characters are bounded with single quotes, the elements are not interpreted. But if they are bounded with double quotes, it means that the contents should be interpreted.

Beginner's Guide To Travel With Perl - Part 1

Something about Perl

Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular amongst programmers. Perl borrows features from other programming languages including C, shell scripting (sh), AWK, and sed. The language provides powerful text processing facilities without the arbitrary data length limits of many contemporary Unix tools, facilitating easy manipulation of text files. Perl gained widespread popularity in the late 1990s as a CGI scripting language, in part due to its parsing abilities.

Popular Posts