Recent Comments


Perl is a scripting language that is supported on all computing platforms (Windows, Unix, Linux, Mac, and mobile devices). It is called a scripting language because it executes immediately without the need for a compile step. This makes writing programs in Perl very fast, but the programmer has to keep track of the variables being used and make sure they are set before they are tested.

The lines that start with a hash (#) are comments and can be placed anywhere in the code to help make it easier to read and understand.

Download software:

Cost: Free

Instructions to setup software:

Hardware requirements: Any PC or laptop computer

Operating systems supported: Win, Mac OS X, Linux

Difficulty level: 2 out of 5


1. Install the Perl compiler on your computer or laptop.

2. Open a text editor (notepad, textedit, vi, or your favorite) and copy/paste the following program into a file:

#...initialize looping variable, assume 'yes' as the first answer
$continueYN = "y";

while ($continueYN eq "y")
   #...get temperature input from the user
   print "Enter next temperature in degrees Fahrenheit (F):";

   $degreeF = <STDIN>;

   #...convert temperature from F to Celsius
   $degreeC = ($degreeF - 32) * 5 / 9;

   print "Temperature in degrees C is: ".$degreeC."\n";

   #...check for temperature below freezing..
   if ($degreeC < 0)
      print "Pack long underwear!\n";

   #...check for it being a hot day...
   if ($degreeF > 100)
      print "Remember to hydrate!\n";

   print "Input another?";

   $continueYN = <STDIN>;

3. Save it as “”

4. Open a command window (cmd.exe, or Unix shell) on your computer and navigate the default directory to the place where you stored “”

5. Run the program with the command “perl”


1. Change the messages to have different advice for extreme temperatures.

2. Change the trigger temperatures (hot or cold) to something different.

3. Add another temperature trigger check for very extreme temps.

4. Collect the person’s name before the loop starts (store in a variable) and add this to the output messages.

5. (Advanced) Change the whole program into a currency converter. Input amount in US dollars and convert to Euros.

LEARN MORE — This site has many examples and other tutorials. -– This hub site has links to many other tutorials and examples. -– Comprehensive Perl Archive Network. Contains many libraries of pre-written programs that can be downloaded and used in your projects. Animation, graphics, encryption, and network utilities are just a few of the kinds of resources available. -– Search for other code and samples.


Scripting languages do not need a compiler, so you can quickly write and test programs by keeping several windows open on your computer. Just keep your working program open in a text editor (like notepad) and have another window open that is running a command line prompt. Then make small changes to the file, save it, and then run it in the other windows. You can grow a simple program into a complex one in this manner.

Leave a Comment

Please don't use your real name.