Main Menu

friends

Banner

Latest articles

XEN DomU configuration files
12/05/2009 | mad mad mod

The Basics
XEN uses 2 different native configuration file formats. The "old" one is S-expressions (sexp) which is usualy used for configuration files in /var/lib/xend/. The default file ending is ".exp [ ... ]


Hello World in java
18/11/2009 | mad mad mod

This article describes how to write, compile and execute a "Hello World" program in java on Linux (Fedora).  1. the prerequisitesa text editor of your choice (e.g. vi)a java compiler (go to http: [ ... ]


Other Articles
Facebook MySpace Twitter Digg Delicious Stumbleupon Google Bookmarks 

Designed by:
SiteGround web hosting Joomla Templates
Hello World in perl E-mail
programming

This article describes how to write and execute a "Hello World" perl script on Linux (Fedora).

 

1. the prerequisites

  • a text editor of your choice (e.g. vi)
  • the perl interpreter


make sure you have installed perl:

# rpm -qa|grep perl

(...)

perl-5.8.8-41.fc8.i386


(...)

 

If it is not installed yet, you can install it with yum (you need to be root to do that):

# yum install perl

 

 

2. write the code


open an empty file with a text editor (e.g. vi):


# vi helloworld.pl



now write the following lines into it:


#!/usr/bin/perl
print "Hello World!\n";



save the file and exit vi with ":wq + enter"

 

explanation


#!/usr/bin/perl

This tells the system to use the /usr/bin/perl interpreter to execute the script. You can find out the full path of your perl interpreter by entering the following command:


# which perl

/usr/bin/perl





print "Hello World!\n";

This prints out the string "Hello World!"  followed by a newline (a carriage return).

 


3. make the script executable



# chmod u+x helloworld.pl




4. run the program


you can now execute the script program with:


# ./helloworld.pl

Hello World!

 

- or -

 


# perl helloworld.pl

Hello World!

 

 

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

 
mad mad mod, Powered by Joomla! and designed by SiteGround web hosting