Perl
  Home arrow Perl arrow Perl: Releasing Your Inner Textuality
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
Google.com  
PERL

Perl: Releasing Your Inner Textuality
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2008-02-25


    Table of Contents:
  • Perl: Releasing Your Inner Textuality
  • Special Characters Don't Need Helmets or Small Buses
  • Printing Variables
  • More Printing Information

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Perl: Releasing Your Inner Textuality
    ( Page 1 of 4 )

    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.

    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:


    #!/usr/bin/perl

    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 Articles          >>> More By James Payne
     

       

    PERL ARTICLES

    - More Perl Bits
    - Perl, Bit by Bit
    - Basic Charting with Perl
    - Using Getopt::Long: More Command Line Option...
    - Command Line Options in Perl: Using Getopt::...
    - Web Access with LWP
    - More Templating Tools for Perl
    - Site Layout with Perl Templating Tools
    - Build a Perl RSS Aggregator with Templating ...
    - Looping, Security, and Templating Tools
    - Perl: Bon Voyage Lists and Hashes
    - Templating Tools
    - Perl: Number Crunching
    - Perl Debuggers in Detail
    - Debugging Perl





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek