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. Working with Scalars

Scalar data are the most basic in Perl. Each scalar datum is logically a single entity. Scalars can be strings of characters or numbers. In Perl, you write literal scalar strings like this:

For example, the strings "foobar" and 'baz' are scalar data. The numbers 3, 3.5 and -1 are also scalar data.

Strings are always enclosed in some sort of quoting, the most common of which are single quotes, ", and and double quotes, "". We'll talk later about how these differ, but for now, you can keep in mind that any string of characters inside either type of quotes are scalar string data.

Numbers are always written without quotes. Any numeric sequence without quotes are scalar number data.

In this chapter, we will take a look at the variety of scalar data available in Perl, the way to store them in variables, how to operate on them, and how to output them.

2.1 Strings  
2.2 Numbers  
2.3 Scalar Variables  
2.4 Operators  
2.5 Output of Scalar Data  
2.6 Special Variables  
2.7 Summary of Scalar Operators  




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