Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 1. The Basics of Perl > Item 8. Understand conversions between strings ...

Item 8. Understand conversions between strings and numbers

Perl’s scalar variables can contain either string or numeric data. They can also contain both at the same time, usually as the result of converting string data to a number, or vice versa.

Perl automatically converts values from numeric to string representation, or vice versa, as required. For example, if a string appears next to a numeric operator like +, Perl converts the string value to a number before proceeding with the arithmetic. If a number is the object of a pattern match, Perl first converts the number to a string.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint