Home arrow Perl Programming arrow Perl: Releasing Your Inner Textuality

Perl: Releasing Your Inner Textuality

There are lots of way to express yourself, but with programming languages the simplest way to do that is usually text. This tutorial will walk you through ways to make text work for you in Perl. It's the first of a three-part series, and since (as usual) we have a lot of ground to cover, let's get started.

  1. Perl: Releasing Your Inner Textuality
  2. Special Characters Don't Need Helmets or Small Buses
  3. Printing Variables
  4. More Printing Information
By: James Payne
Rating: starstarstarstarstar / 1
February 25, 2008

print this article



As you will no doubt recall, we discussed strings on a surface sort of a level a while back. Here, in this tutorial we will go more in depth. We will start off with the basics, so if you are a pro, feel free to skip over that section. If not, or if you want a refresher, sit back, take a sip of that wine in the box over there on the table, and as the great Marvin Gaye once said, let's get it on.

Basic Printing

We learned before how to write basic text to the screen using the print command. As a refresher, here it is again:


print "My name is James Payne. ";

print "I am the world's fattest man.";

print "My weight is equivalent to that of 17 suns. ";

print "Or 17 of Oprah's sons. You pick. ";

print 102;

print " 102 ";

print 10+2;

print " 10+2 "

When you run this program, you get the following result:

  My name is James Payne. I am the world's fattest man. My weight is equivalent to that of 17 suns. Or 17 of Oprah's sons. You pick. 102 102 12 10+2

As you can see, all of our text is printed on the same line. If I had not put a space at the end of each sentence, it would all be bunched up as well. To fix this issue we can use what are known as special characters.

>>> More Perl Programming Articles          >>> More By James Payne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Perl Turns 25
- Lists and Arguments in Perl
- Variables and Arguments in Perl
- Understanding Scope and Packages in Perl
- Arguments and Return Values in Perl
- Invoking Perl Subroutines and Functions
- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions

Developer Shed Affiliates


Dev Shed Tutorial Topics: