Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]


2.1.3.4 Examples of Interpolation (ASCII Hex Values)

You need not use only the octal values when interpolating ASCII characters into double-quoted strings. You can also use the hexadecimal values. Here is our same program using the hexadecimal values this time instead of the octal values:

#!/usr/bin/perl use strict; use warnings; print "A backslash: \x5C\n"; print "Tab follows:\x09over here\n"; print "Ring! \x07\n"; print "Please pay bkuhn\x40ebb.org \x2420.\n";

As you can see, the theme of "there's more than one way to do it" is really playing out here. However, we only used the ASCII codes as a didactic exercise. Usually, you should use the single character sequences (like `\a' and `\t'), unless, of course, you are including an ASCII character that does not have a shortcut, single character sequence.


 
 
  Published under the terms of the GNU General Public License Design by Interspire