Main Menu

friends

Latest articles

computer stupidities - The World Wide Web
12/04/2010 | mad mad mod

"The World Wide Web provides a new arena for computer stupidities. Now users can be stupid to a world wide audience. Fortunately for us, most of them are too confused about what the web is to figure [ ... ]


Where in the world is kate?
30/12/2009 | mad mad mod

If you are also looking for kate on Fedora 10, 11 or 12: the package is now called "kdesdk"   # yum install kdesdk    


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