Monday, 28 October 2013

PS_00_Exercise Hello_World_0

Perl : (Practical Extraction Reporting Language)
It is a powerful language for text manipulation and system administration.
It is modular, it supports procedures, object orientation, it can parse text.

# touch helloworld.pl
# vi helloworld.pl

#!/usr/bin/perl -w
# Author: Arjun Shrinivas
# Date: 27.10.2013
# Purpose: Echoes Hello World.

print "Hello World\n";

#END
:wq

Now here's some explanation (in case you need any):

1. The string is enclosed in double-quotes(" ... ") because that's how string constants are represented in perl.
2. \n is a special character that is called "newline". When you print a newline you will see that your output started on a new line.
3. The semi-colon (;) at the end indicates that this is the end of a perl command. Every perl command should be terminated with a semicolon.

"The content which is placed with in double quotes will be printed explicitly."
The output for "Hello World\n"; will be
# perl -w helloworld.pl
Hello World
#
'The content which is placed with in single quotes will be printed literally than explicitly.'
The output for 'Hello World\n'; will be
# perl -w helloworld.pl
Hello World\n#

No comments :

Post a Comment