Tuesday, 27 August 2013

Basic Perl concepts


Hi,

Greetings of the day

Here is today’s article for u

This article assumes that you already know how to program  know the C programming language, this will be especially easy for you. Perl is easy to use once you know the basics. In this article, we're going to start at the beginning and show you how to do the most common programming tasks using Perl. By the end of this article, you will be able to write your own Perl scripts with relative ease, and read cryptic scripts written by others with somewhat less ease, but this will be a good starting point.
         To start with Perl you need the Perl interpreter which already present in UNIX machine, where as in windows we have to download i.e. latest versions
PERL is a open source, DOCS directory that comes with Perl where u can find User manual
Once you have Perl loaded, make sure you have your path properly set to include the Perl executable. Then, open a text editor and create a text file. In the file, place the following line:
print "21cssindiacom\n";
Name the file "test1.pl". At the command prompt, type:
perl test1.pl
Perl will run and execute the code in the text file. You should see the words "21cssindia.com" printed to stdout (standard out). As you can see, it is extremely easy to create and run programs in Perl. (If you are using UNIX, you can place a comment like #! /usr/bin/perl on the first line, and then you will not have to type the word "perl" at the command line.)
The print command prints things to stdout. The \n notation is a line feed. That would be more clear if you modified the test program to look like this (# denotes a comment):
# Print on two lines
   print "21css \n indiacom\n";
Note that the print command understood that it should interpret the "\n" as a line feed and not as the literal characters. The interpretation occurred not because of the print command, but because of the use of double quotes (a practice called quoting in Perl). If you were to use single quotes instead, as in:
print '21css\nindiacom\n';
The \n character would not be interpreted but instead would be used literally.
There is also the backquote character: `. A pair of these implies that what is inside the quotes should be interpreted as an operating system command, and that command should be executed with the output of the command being printed. If you were to place inside the backquotes a command-line operation from the operating system, it would execute. For example, on Windows NT you can say:
print `cmd /c dir`;
to run the DIR command and see a list of files from the current directory.
You will also see the / character used for quoting regular expressions.
The print command understands commas as separators. For example:
print '21css', "\n", 'indiacom';
However, you will also see a period:
print '21cssindia'. "\n". 'com';
The period is actually a string concatenation operator.
There is also a printf operator for C folks.
PERL Note
In Windows NT, you cannot say:
print `dir`;
Because dir is not a separate executable -- it's part of the command interpreter cmd. Type cmd /? at a DOS prompt for details

meet u again....
         We, 21st Century software solutions one of the best institute providing quality level of training for corporate & E-learning for individuals
We offer instructor led online training in u'r comfortable timings.
We also arrange corporate trainings if group of people are interested in same technology.We are starting a new batch for PERL.Demo can be scheduled for on-line training on Ur request.Contact us for custom designed training course by experts exclusively for yourself.
         We provide training for almost all IT technologies, i.e; SAP, ORACLE, JAVA, DOTNET, STORAGE products, HYPERION etc.

Contact us if you have any particular need.

Thanks a bunch in advance for accepting our services.

21st Century Software Solutions                            
USA: 001 2012108616
INDIA: +919000444287



Technology
Tandblekningbilligt.blogspot.se

No comments:

Post a Comment