Home arrow Perl Programming arrow Page 3 - Perl Text: Quoting Without Quote Marks

Formatting with the Here Document - Perl

In our last article we introduced you to using text in Perl. By the time we were done, there was text everywhere. But that's okay. In this tutorial we will learn to clean that text up and put it in its place. So roll up those sleeves and prepare to get organized. No more sloppy text for you!

TABLE OF CONTENTS:
  1. Perl Text: Quoting Without Quote Marks
  2. Working with the Here Document...Over There
  3. Formatting with the Here Document
  4. You Can Look But Don't Touch
By: James Payne
Rating: starstarstarstarstar / 2
March 03, 2008

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Another benefit to the here document is the ability to format your text and have it appear exactly as you typed it in. Here is a poem that we will display using the here document:


#!/usr/bin/perl

$twain= <<'Poem';

Warm summer sun,

  Shine kindly here,

Warm southern wind,

  Blow softly here.

Green sod above,

  Lie light, lie light.

Good night, dear heart,

  Good night, good night.

Poem

print $twain;

This will display Twain's poem like so:

Warm summer sun,

  Shine kindly here.

Warm southern wind,

  Blow softly here.

Green sod above,

  Lie light, lie light.

Good night, dear heart,

  Good night, good night.



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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PERL PROGRAMMING ARTICLES

- 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: