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

 
Developer Updates  
Free Website Content 
OLM
 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? 
PERL

Perl: Releasing Your Inner Textuality
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 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:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb 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

    Anyone looking for a way to modernize legacy data or easily migrate to a more cost-effective database without sacrificing functionality will benefit from this seminar. View the Intro to Advantage Database Server now!

    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


       · Thank you for dropping by to read my article on working with Perl Text. This is the...
       · In your second example you missed your backslash.print "My email address is...
       · Hey thanks for catching that; our CMS gobbles up the backslashes sometimes. I'll be...
       · Nice article for beginners, but in the example with the $ you're missing the...
       · Hey, thanks for the comment, and for catching that missing backslash. The CMS we use...
     

       

    PERL ARTICLES

    - Perl: Another Round with Hashes
    - Perl Hashes
    - Perl Lists: A Final Look at List::Util
    - Perl Lists: Utilizing List::Util
    - Perl Lists: The Split() Function
    - SQL and CGI with Perl and DBI
    - Perl Lists: More Functions and Operators
    - SELECT Queries and Perl
    - Perl Lists: More on Manipulation
    - Creating a Database with Perl and DBI
    - Perl: Sailing the List(less) Seas
    - Perl and DBI
    - Perl: Concatenating Text and More
    - Perl Text: Quoting Without Quote Marks
    - Perl: Releasing Your Inner Textuality

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway