Commits

Shlomi Fish committed 5a5094d Merge

Merge from modern_perl_2011_2012_ed .

Comments (0)

Files changed (28)

src/tutorials/modern-perl/epub/modern_perl.epub

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_00.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_01.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_02.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_03.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_04.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_05.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_06.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_07.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_08.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_09.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_10.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_11.pdf

Binary file modified.

src/tutorials/modern-perl/pdf/chapter_12.pdf

Binary file modified.

src/tutorials/modern-perl/xhtml/chapter_00.html

 <?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<meta name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
+<meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
 <title></title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" href="../styles/style.css" type="text/css" />
 </head>
 <body>
-<h1 id="heading_id_2">Preface</h1>
-<p>Perl turns 23 years old later this year. The language has gone from a simple tool for system adminstration somewhere between shell scripting and C programming (Perl 1) to a powerful, general purpose language steeped in a rich heritage (Perl 5) and a consistent, coherent, rethinking of programming in general intended to last for another 25 years (Perl 6).</p>
-<p>Even so, most Perl 5 programs in the world take far too little advantage of the language. You <i>can</i> write Perl 5 programs as if they were Perl 4 programs (or Perl 3 or 2 or 1), but programs written to take advantage of everything amazing the worldwide Perl 5 community has invented, polished, and discovered are shorter, faster, more powerful, and easier to maintain than their alternatives.</p>
-<p><i>Modern Perl</i> is a loose description of how experienced and effective Perl 5 programers work. They use language idioms. They take advantage of the CPAN. They're recognizably Perlish, and they show good taste and craftsmanship and a full understanding of Perl.</p>
-<p>You can learn this too.</p>
+<h1 id="heading_id_2">*Preface</h1>
+<p><em>Modern Perl</em> is one way to describe the way the world's most effective Perl 5 programmers work. They use language idioms. They take advantage of the CPAN. They show good taste and craft to write powerful, maintainable, scalable, concise, and effective code. You can learn these skills too!</p>
+<p>Perl first appeared in 1987 as a simple tool for system administration. Though it began by declaring and occupying a comfortable niche between shell scripting and C programming, it has become a powerful, general-purpose language family. Perl 5 has a solid history of pragmatism and a bright future of polish and enhancement <span class="footnote">(footnote: Perl 6 is a reinvention of programming based on the solid principles of Perl, but it's a subject of another book.)</span>.</p>
+<p>Over Perl's long history--especially the 17 years of Perl 5--our understanding of what makes great Perl programs has changed. While you can write productive programs which never take advantage of all the language has to offer, the global Perl community has invented, borrowed, enhanced, and polished ideas and made them available to anyone willing to learn them.</p>
 <h2 id="heading_id_3">Running Modern Perl</h2>
-<p>You don't have to install a new version of Perl to take advantage of most of this book, but the examples given assume that you're using Perl 5.10 or newer. Unless otherwise mentioned, code snippets always assume the basic skeleton of a program:</p>
+<p>The <code>Modern::Perl</code> module from the CPAN (<a href="chapter_02.html#cpan">The CPAN</a>(cpan)) asks Perl to warn of dubious constructs and typos and will enable new features introduced in modern releases of Perl 5. Unless otherwise mentioned, code snippets always assume the basic skeleton of a program:</p>
 <div class="programlisting">
 <pre>
-<code>    #!/usr/bin/perl
+<code>    #!/usr/bin/env perl
+
+    use Modern::Perl 2011;
+    use autodie;</code>
+</pre></div>
+<p>... which is equivalent to:</p>
+<div class="programlisting">
+<pre>
+<code>    #!/usr/bin/env perl
+
+    use 5.012;      # implies "use strict;"
+    use warnings;
+    use autodie;</code>
+</pre></div>
+<p>Some examples use testing functions such as <code>ok()</code>, <code>like()</code>, and <code>is()</code> (<a href="chapter_09.html#testing">Testing</a>(testing)). These programs follow the pattern:</p>
+<div class="programlisting">
+<pre>
+<code>    #!/usr/bin/env perl
 
     use Modern::Perl;
+    <strong>use Test::More;</strong>
 
     # example code here
-    ...</code>
+
+    <strong>done_testing();</strong></code>
 </pre></div>
-<p>Other code snippets use testing functions such as <code>ok()</code>, <code>like()</code>, and <code>is()</code> (<a href="chapter_09.html#testing">Testing</a>(testing)). That skeleton program is:</p>
-<div class="programlisting">
-<pre>
-<code>    #!/usr/bin/perl
-
-    use Modern::Perl;
-    <b>use Test::More 'no_Plan';</b>
-
-    # example code here
-    ...</code>
-</pre></div>
-<p>If you don't already have a modern version of Perl installed, you can install it yourself, using:</p>
-<div class="author">
-<pre>
-<code> * perlbrew
- * Strawberry Perl
- * local::lib</code>
-</pre></div>
+<p>At the time of writing, the current stable Perl 5 release family is Perl 5.14. The examples in this book work best with Perl 5.12.0 or newer. Many examples will work on older versions of Perl 5 with modest changes, but you will have more difficulty with anything older than 5.10.0.</p>
+<div id="iStrawberry_Perl_0"></div>
+<div id="iActivePerl_0"></div>
+<div id="iperlbrew_0"></div>
+<div id="iCPAN__iApp5858perlbrew_0"></div>
+<p>If you have no Perl 5 installed (or if you have an old version installed), you can install a newer release yourself. Windows users, download Strawberry Perl from <span class="url">http://www.strawberryperl.com/</span> or ActivePerl from <span class="url">http://www.activestate.com/activeperl</span>. Users of other operating systems with Perl 5 already installed (and a C compiler and the other development tools), start by installing the CPAN module <code>App::perlbrew</code> <span class="footnote">(footnote: See <span class="url">http://search.cpan.org/perldoc?App::perlbrew</span> for installation instructions.)</span>.</p>
+<p><code>perlbrew</code> allows you to install and manage multiple versions of Perl 5. This allows you to switch between versions of Perl 5 as well as to install Perl 5 and CPAN modules in your home directory without affecting the system's version. If you've ever had to beg your system administrator for permission to install software, you know how much easier your life can be now.</p>
+<h2 id="heading_id_4">Credits</h2>
+<p>This book would not have been possible without questions, comments, suggestions, advice, wisdom, and encouragement from many, many people. In particular, the author and editor thank:</p>
+<div id="credits"></div>
+John SJ Anderson, Peter Aronoff, Lee Aylward, Alex Balhatchet, Ævar Arnfjörð Bjarmason, Matthias Bloch, John Bokma, Vasily Chekalkin, Dmitry Chestnykh, E. Choroba, Tom Christiansen, Anneli Cuss, Paulo Custodio, Steve Dickinson, Kurt Edmiston, Felipe, Shlomi Fish, Jeremiah Foster, Mark Fowler, John Gabriele, Andrew Grangaard, Bruce Gray, Ask Bjørn Hansen, Tim Heaney, Graeme Hewson, Robert Hicks, Michael Hind, Mark Hindess, Yary Hluchan, Daniel Holz, Mike Huffman, Gary H. Jones II, Curtis Jewell, Mohammed Arafat Kamaal, James E Keenan, Kirk Kimmel, Yuval Kogman, Jan Krynicky, Michael Lang, Jeff Lavallee, Moritz Lenz, Andy Lester, Jean-Baptiste Mazon, Josh McAdams, Gareth McCaughan, John McNamara, Shawn M Moore, Alex Muntada, Carl Mäsak, Chris Niswander, Nelo Onyiah, Chas. Owens, ww from PerlMonks, Jess Robinson, Dave Rolsky, Gabrielle Roth, Jean-Pierre Rupp, Eduardo Santiago, Andrew Savige, Lorne Schachter, Steve Schulze, Dan Scott, Alexander Scott-Johns, Phillip Smith, Christopher E. Stith, Mark A. Stratman, Bryan Summersett, Audrey Tang, Scott Thomson, Ben Tilly, Ruud H. G. van Tol, Sam Vilain, Larry Wall, Lewis Wall, Colin Wetherbee, Frank Wiegand, Doug Wilson, Sawyer X, David Yingling, Marko Zagozen, harleypig, hbm, and sunnavy.
+<p>Any remaining errors are the fault of the stubborn author.</p>
 </body>
 </html>

src/tutorials/modern-perl/xhtml/chapter_01.html

     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<meta name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
+<meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
 <title></title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" href="../styles/style.css" type="text/css" />
 </head>
 <body>
-<h2 id="heading_id_2">The Perl Philosophy</h2>
-<p>Perl is a language for getting things done. It's flexible, forgiving, and malleable. In the hands of a capable programmer, it can perform almost any task, from one-liner calculations and automations to multi-programmer, multi-year projects and everything in between.</p>
-<p>Perl is powerful, and modern Perl--Perl which takes advantage of the best knowledge, deepest experience, and reusable idioms of the global Perl community--can be maintainable, fast, and easy to use. Perhaps most importantly, it can help you do what you need to do with little frustration and no ceremony.</p>
-<p>Perl is a pragmatic language. You, the programmer, are in charge. Rather than manipulating your mind and your problems to fit how the language designer thinks you should write programs, Perl allows you to solve your problems as you see fit.</p>
-<p>Perl is a language which can grow with you. You can write useful programs with the knowledge that you can learn in an hour of reading this book. Yet if you take the time to understand the philosophies behind the syntax, semantics, and design of the language, you can be far more productive.</p>
+<h1 id="heading_id_2">The Perl Philosophy</h1>
+<p>Perl gets things done--it's flexible, forgiving, and malleable. Capable programmers use it every day for everything from one-liners and one-off automations to multi-year, multi-programmer projects.</p>
+<p>Perl is pragmatic. You're in charge. You decide how to solve your problems and Perl will mold itself to do what you mean, with little frustration and no ceremony.</p>
+<p>Perl will grow with you. In the next hour, you'll learn enough to write real, useful programs--and you'll understand <em>how</em> the language works and <em>why</em> it works as it does. Modern Perl takes advantage of this knowledge and the combined experience of the global Perl community to help you write working, maintainable code.</p>
 <p>First, you need to know how to learn more.</p>
-<h4 id="heading_id_3">Perldoc</h4>
+<h2 id="heading_id_3">Perldoc</h2>
 <div id="perldoc"></div>
-<p>One of Perl's most useful and least appreciated features is the <code>perldoc</code> utility. This program is part of every complete Perl 5 installation <span class="footnote">(footnote: You may have to install an additional package on a free GNU/Linux distribution or another Unix-like system; on Debian and Ubuntu this is <code>perl-doc</code>.)</span>. It displays the documentation of every Perl module installed on the system--whether a core module or one installed from the Comprehensive Perl Archive Network (CPAN)--as well as thousands of pages of Perl's copious core documentation.</p>
+<div id="iperldoc_0"></div>
+<p>Perl has a culture of useful documentation. The <code>perldoc</code> utility is part of every complete Perl 5 installation <span class="footnote">(footnote: However your Unix-like system may require you to install an additional package such as <code>perl-doc</code> on Debian or Ubuntu GNU/Linux.)</span>. <code>perldoc</code> displays the documentation of every Perl module installed on the system--whether a core module or one installed from the Comprehensive Perl Archive Network (CPAN)--as well as thousands of pages of Perl's copious core documentation.</p>
 <div class="sidebar">
-<p>If you prefer an online version, <span class="url">http://perldoc.perl.org/</span> hosts recent versions of the Perl documentation. <span class="url">http://search.cpan.org/</span> displays the documentation of every module on the CPAN. Windows users, both ActivePerl and Strawberry Perl provide a link in your Start menu to the documentation.</p>
+<div id="iCPAN_0"></div>
+<div id="imetacpan_0"></div>
+<p><span class="url">http://perldoc.perl.org/</span> hosts recent versions of the Perl documentation. CPAN indexes at <span class="url">http://search.cpan.org/</span> and <span class="url">http://metacpan.org/</span> provide documentation for all CPAN modules. Other Perl 5 distributions such as ActivePerl and Strawberry Perl provide local documentation in HTML formats.</p>
 </div>
-<p>The default behavior of <code>perldoc</code> is to display the documentation for a named module or a specific section of the core documentation:</p>
+<p>Use <code>perldoc</code> to read the documentation for a module or part of the core documentation:</p>
+<div class="screen">
 <pre>
-<code>    $ <b>perldoc List::Util</b>
-    $ <b>perldoc perltoc</b>
-    $ <b>perldoc Moose::Manual</b></code>
-</pre>
-<p>The first example extracts documentation written for the <code>List::Util</code> module and displays it in a form appropriate for your screen. Community standards for CPAN modules (<a href="chapter_02.html#cpan">The CPAN</a>(cpan)) suggest that additional libraries use the same documentation format and form as core modules, so there's no distinction between reading the documentation for a core library such as <code>Data::Dumper</code> or one installed from the CPAN. The standard documentation template includes a description of the module, demonstrates sample uses, and then contains a detailed explanation of the module and its interface. While the amount of documentation varies by author, the form of the documentation is remarkably consistent.</p>
-<p>The second example displays a pure documentation file, in this case the table of contents of the core documentation itself. This file describes each individual piece of the core documentation; browse it for a good understanding of Perl's breadth.</p>
-<p>The third example resembles the second; <code>Moose::Manual</code> is part of the Moose CPAN distribution (<a href="chapter_07.html#moose">Moose</a>(moose)). It is also purely documentation; it contains no code.</p>
-<div class="sidebar">
-<p>Similarly, <code>perldoc perlfaq</code> will display the table of contents for Frequently Asked Questions about Perl 5. Skimming these questions is invaluable.</p>
+<code>    $ <strong>perldoc List::Util</strong>
+    $ <strong>perldoc perltoc</strong>
+    $ <strong>perldoc Moose::Manual</strong></code>
+</pre></div>
+<p>The first example displays the documentation embedded within the <code>List::Util</code> module. The second example displays a pure documentation file, in this case the table of contents of the core documentation. The third example displays a pure documentation file included as part of a CPAN distribution (<a href="chapter_07.html#moose">Moose</a>(moose)). <code>perldoc</code> hides these details; there's no distinction between reading the documentation for a core library such as <code>Data::Dumper</code> or one installed from the CPAN.</p>
+<p>The standard documentation template includes a description of the module, demonstrates sample uses, and then contains a detailed explanation of the module and its interface. While the amount of documentation varies by author, the form of the documentation is remarkably consistent.</p>
+<div class="tip">
+<p><code>perldoc perltoc</code> displays the table of contents of the core documentation, and <code>perldoc perlfaq</code> displays the table of contents for Frequently Asked Questions about Perl 5. <code>perldoc perlop</code> and <code>perldoc perlsyn</code> document Perl's symbolic operators and syntactic constructs. <code>perldoc perldiag</code> explains the meanings of Perl's warning messages. <code>perldoc perlvar</code> lists all of Perl's symbolic variables. Skimming these files will give you a great overview of Perl 5.</p>
 </div>
-<div id="iperldoc__i45q_0"></div>
-<p>The <code>perldoc</code> utility has many more abilities (see <code>perldoc perldoc</code>). Two of the most useful are the <code>-q</code> and the <code>-f</code> flags. The <code>-q</code> flag takes a keyword or keywords and searches only the Perl FAQ, displaying all results. Thus <code>perldoc -q sort</code> returns three questions: <i>How do I sort an array by (anything)?</i>, <i>How do I sort a hash (optionally by value instead of key)?</i>, and <i>How can I always keep my hash sorted?</i>.</p>
-<div id="iperldoc__i45f_0"></div>
-<p>The <code>-f</code> flag displays the core documentation for a builtin Perl function. <code>perldoc -f sort</code> explains the behavior of the <code>sort</code> operator. If you don't know the name of the function you want, use <code>perldoc perlfunc</code> to see a list of functions.</p>
-<div class="sidebar">
-<p><code>perldoc perlop</code> and <code>perldoc perlsyn</code> document Perl's symbolic operators and syntactic constructs; <code>perldoc perldiag</code> explains the meanings of Perl's warning messages.</p>
-</div>
+<div id="iperldoc__i45q_40search_perlfaq41_0"></div>
+<p>The <code>perldoc</code> utility has many more abilities (see <code>perldoc perldoc</code>). The <code>-q</code> option searches only the Perl FAQ for any provided keywords. Thus <code>perldoc -q sort</code> returns three questions: <em>How do I sort an array by (anything)?</em>, <em>How do I sort a hash (optionally by value instead of key)?</em>, and <em>How can I always keep my hash sorted?</em>.</p>
+<div id="iperldoc__i45f_40search_perlfunc41_0"></div>
+<p>The <code>-f</code> option displays the documentation for a builtin Perl function. <code>perldoc -f sort</code> explains the behavior of the <code>sort</code> operator. If you don't know the name of the function you want, browse the list of available builtins in <code>perldoc perlfunc</code>.</p>
+<div id="iperldoc__i45v_40search_perlvar41_0"></div>
+<p>The <code>-v</code> option looks up a builtin variable. For example, <code>perldoc -v $PID</code> displays the documentation for the variable which contains the current program's process id. Depending on your shell, you may have to quote the variable appropriately.</p>
+<p>The <code>-l</code> option causes <code>perldoc</code> to display the <em>path</em> to the documentation file rather than the contents of the documentation <span class="footnote">(footnote: Be aware that a module may have a separate <em>.pod</em> file in addition to its <em>.pm</em> file.)</span>.</p>
+<p>The <code>-m</code> option displays the entire <em>contents</em> of the module, code and all, without performing any special formatting.</p>
 <div id="iPOD_0"></div>
-<p>Perl 5's documentation system is <i>POD</i>, or <i>Plain Old Documentation</i>. <code>perldoc perlpod</code> describes how POD works. The <code>perldoc</code> utility will display the POD in any Perl module you create and install for your project, and other POD tools such as <code>podchecker</code>, which validates the form of your POD, and <code>Pod::Webserver</code>, which displays local POD as HTML through a minimal webserver, will handle valid POD correctly.</p>
-<div id="iperldoc__i45l_0"></div>
-<div id="iperldoc__i45m_0"></div>
-<p><code>perldoc</code> has other uses. With the <code>-l</code> command-line flag, it displays the <i>path</i> to the documentation file rather than the contents of the documentation <span class="footnote">(footnote: Be aware that a module may have a separate <i>.pod</i> file in addition to its <i>.pm</i> file.)</span>. With the <code>-m</code> flag, it displays the entire <i>contents</i> of the module, code and all, without processing any POD instructions.</p>
-<h4 id="heading_id_4">Expressivity</h4>
+<div id="iPOD__iperldoc_0"></div>
+<div id="iPOD__ipodchecker_0"></div>
+<div id="iPOD__iPod5858Webserver_0"></div>
+<div id="iCPAN__iPod5858Webserver_0"></div>
+<p>Perl 5's documentation system is <em>POD</em>, or <em>Plain Old Documentation</em>. <code>perldoc perlpod</code> describes how POD works. Other POD tools include <code>podchecker</code>, which validates the form of your POD, and <code>Pod::Webserver</code>, which displays local POD as HTML through a minimal web server.</p>
+<h2 id="heading_id_4">Expressivity</h2>
 <div id="expressivity"></div>
 <div id="iWall44_Larry_0"></div>
 <div id="iLarry_Wall_0"></div>
-<p>Before Larry Wall created Perl, he studied linguistics and human languages. His experiences continue to influence Perl's design. There are many ways to write a Perl program depending on your project's style, the available time to create the program, the expected maintenance burden, or even your own personal sense of expression. You may write in a straightforward, top-to-bottom style. You may write many small and independent functions. You may model your problem with classes and objects. You may eschew or embrace advanced features.</p>
+<p>Larry Wall's studies of linguistics and human languages influenced the design of Perl. The language allows you tremendous freedom to solve your problems, depending on your group style, the available time, the expected lifespan of the program, or even how creative you feel. You may write simple, straightforward code or integrate into larger, well-defined programs. You may select from multiple design paradigms, and you may eschew or embrace advanced features.</p>
+<p>Where other languages enforce one best way to write any code, Perl allows <em>you</em> to decide what's most readable or useful or fun.</p>
 <div id="iTIMTOWTDI_0"></div>
 <div id="iTim_Toady_0"></div>
-<p>Perl hackers have a slogan for this: <i>TIMTOWTDI</i>, pronounced "Tim Toady", or "There's more than one way to do it!"</p>
-<p>Where this expressivity can provide a large palette with which master craftsman can create amazing and powerful edifices, unwise conglomerations of various techniques can impede maintainability and comprehensibility. You can write good code or you can make a mess. The choice is yours <span class="footnote">(footnote: ... but be kind to other people, if you must make a mess.)</span>.</p>
-<p>Where other languages might suggest that one enforced way to perform any operation is the right solution, Perl allows you to optimize for your most important criteria. Within the realm of your own problems, you can choose from several good approaches--but be mindful of readability and future maintainability.</p>
-<p>As a novice to Perl, you may find certain constructs difficult to understand. The greater Perl community has discovered and promoted several idioms (<a href="chapter_10.html#idioms">Idioms</a>(idioms)) which offer great power. Don't expect to understand them immediately. Some of Perl's features interact in subtle ways.</p>
-<div class="sidebar">
-<p>Learning Perl is like learning a second or third spoken language. You'll learn a few words, then string together some sentences, and eventually will be able to have small, simple conversations. Mastery comes with practice, both reading and writing. You don't have to understand all of the details of this chapter immediately to be productive with Perl. Keep the principles as you read the rest of this book.</p>
-</div>
-<p>Another design goal of Perl is to surprise experienced (Perl) programmers very little. For example, adding two scalars together with a numeric operator (<code>$first_num + $second_num</code>) is obviously a numeric operation; the operator must treat both scalars as numeric values to produce a numeric result. No matter what the contents of <code>$first_num</code> and <code>$second_num</code>, Perl will coerce them to numeric values (<a href="chapter_03.html#numeric_coercion">Numeric Coercion</a>(numeric_coercion)) without requiring the user or programmer to perform this conversion manually. You've expressed your intent to treat them as numbers by choosing a numeric operator (<a href="chapter_04.html#numeric_operators">Numeric Operators</a>(numeric_operators)), so Perl happily handles the rest.</p>
+<p>Perl hackers have a slogan for this: <em>TIMTOWTDI</em>, pronounced "Tim Toady", or "There's more than one way to do it!"</p>
+<p>Though this expressivity allows master craftworkers to create amazing programs, it allows the unwise or uncautious to make messes. Experience and good taste will guide you to write great code. The choice is yours--but be mindful of readability and maintainability, especially for those who come after you.</p>
+<p>Perl novices often may find certain constructs opaque. Many of these idioms (<a href="chapter_10.html#idioms">Idioms</a>(idioms)) offer great (if subtle) power. It's okay to avoid them until you're comfortable with them.</p>
+<p>Learning Perl is like learning a new spoken language. You'll learn a few words, string together sentences, and soon will enjoy simple conversations. Mastery comes with practice of reading and writing. You don't have to understand every detail of Perl to be productive, but the principles in this chapter are vital to your growth as a programmer.</p>
+<p>As another design goal, Perl tries to avoid surprising experienced (Perl) programmers. For example, adding two variables (<code>$first_num + $second_num</code>) is obviously a numeric operation (<a href="chapter_04.html#numeric_operators">Numeric Operators</a>(numeric_operators)); the addition operator must treat both as numeric values to produce a numeric result. No matter the contents of <code>$first_num</code> and <code>$second_num</code>, Perl will coerce them to numeric values (<a href="chapter_03.html#numeric_coercion">Numeric Coercion</a>(numeric_coercion)). You've expressed your intent to treat them as numbers by using a numeric operator. Perl happily does so.</p>
 <div id="iDWIM_0"></div>
 <div id="iprinciple_of_least_astonishment_0"></div>
-<p>In general, Perl programmers can expect Perl to do what you mean; this is the notion of <i>DWIM</i>--<i>do what I mean</i>. You may also see this mentioned as the <i>principle of least astonishment</i>. Given a cursory understanding of Perl (especially its <a href="chapter_01.html#context_philosophy">Context</a>(context_philosophy)), it should be possible to read a single unfamiliar Perl expression and understand its intent.</p>
+<p>Perl adepts often call this principle <em>DWIM</em>, or <em>do what I mean</em>. Another phrasing is that Perl follows the <em>principle of least astonishment</em>. Given a cursory understanding of Perl (especially context; <a href="chapter_01.html#context_philosophy">Context</a>(context_philosophy)), it should be possible to understand the intent of an unfamiliar Perl expression. You will develop this skill.</p>
 <div id="ibaby_Perl_0"></div>
-<p>If you're new to Perl, you will develop this skill over time. The flip side of Perl's expressivity is that Perl novices can write useful programs before they learn all of Perl's powerful features. The Perl community often refers to this as <i>baby Perl</i>. Though it may sound dismissive, please don't take offense; everyone was a novice once. Take the opportunity to learn from more experienced programmers and ask for explanations of idioms and constructs you don't yet understand.</p>
-<div class="sidebar">
-<p>A Perl novice might multiply a list of numbers by three by writing:</p>
+<p>Perl's expressivity also allows novices to write useful programs without having to understand everything. The resulting code is often called <em>baby Perl</em>, in the sense that most everyone wants to help babies learn to communicate well. Everyone begins as a novice. Through practice and learning from more experienced programmers, you will understand and adopt more powerful idioms and techniques.</p>
+<p>For example, an experienced Perl hacker might triple a list of numbers with:</p>
 <div class="programlisting">
 <pre>
-<code>    my @tripled;
-    my $count = @numbers;
-
-    for (my $i = 0; $i &lt; $count; $i++)
-    {
-        $tripled[$i] = $numbers[$i] * 3;
-    }</code>
+<code>    my @tripled = map { $_ * 3 } @numbers;</code>
 </pre></div>
-<p>A Perl adept might write:</p>
+<p>... and a Perl adept might write:</p>
 <div class="programlisting">
 <pre>
 <code>    my @tripled;
         push @tripled, $num * 3;
     }</code>
 </pre></div>
-<p>An experienced Perl hacker might write:</p>
+<p>... while a novice might try:</p>
 <div class="programlisting">
 <pre>
-<code>    my @tripled = map { $_ * 3 } @numbers;</code>
+<code>    my @tripled;
+
+    for (my $i = 0; $i &lt; scalar @numbers; $i++)
+    {
+        $tripled[$i] = $numbers[$i] * 3;
+    }</code>
 </pre></div>
-<p>Experience writing Perl will help you to focus on what you want to do rather than how to do it.</p>
-</div>
-<p>Perl is a language intended to grow with your understanding of programming. It won't punish you for writing simple programs. It allows you to refine and expand programs for clarity, expressivity, reuse, and maintainability. Take advantage of this philosophy. It's more important to accomplish your task well than to write a conceptually pure and beautiful program.</p>
-<p>The rest of this book demonstrates how to use Perl to your advantage.</p>
-<h4 id="heading_id_5">Context</h4>
+<p>All three approaches accomplish the same thing, but each uses Perl in a different way.</p>
+<p>Experience writing Perl will help you to focus on <em>what</em> you want to do rather than <em>how</em> to do it. Even so, Perl will happily run simple programs. You can design and refine your programs for clarity, expressivity, reuse, and maintainability, in part or in whole. Take advantage of this flexibility and pragmatism: it's far better to accomplish your task effectively now than to write a conceptually pure and beautiful program next year.</p>
+<h2 id="heading_id_5">Context</h2>
 <div id="context_philosophy"></div>
 <div id="icontext_0"></div>
-<p>Spoken languages have a notion of <i>context</i> where the correct usage or meaning of a word or phrase depends on its surroundings. You may understand this in a spoken language, where the inappropriate pluralization of "Please give me one hamburgers!" <span class="footnote">(footnote: The pluralization of the noun differs from the amount.)</span> sounds wrong or the incorrect gender of "la gato" <span class="footnote">(footnote: The article is feminine, but the noun is masculine.)</span> makes native speakers chuckle.</p>
-<p>Context in Perl is similar; the language understands expectations of the amount of data to provide as well as what kind of data to provide. Perl will happily attempt to provide exactly what you ask for.</p>
-<p>One type of context in Perl means that certain operators have different behavior if you want zero, one, or many results. It's possible that a specific construct in Perl will do something different if you say "Fetch me zero results; I don't care about any" than if you say "Fetch me one result" or "Fetch me many results."</p>
-<p>Likewise, certain contexts make it clear that you expect a numeric value, a string value, or a value that's either true or false.</p>
-<p>Context can be tricky if you try to write or read Perl code as a series of single expressions which stand apart from from their environments. You may find yourself slapping your forehead after a long debugging session when you discover that your assumptions about context were incorrect. However, if you're cognizant of contexts, they can make your code clearer, more concise, and more flexible.</p>
-<h5 id="heading_id_6">Void, Scalar, and List Context</h5>
+<p>In spoken languages, the meaning of a word or phrase may depend on how you use it; the local <em>context</em> helps clarify the intent. For example, the inappropriate pluralization of "Please give me one hamburgers!" <span class="footnote">(footnote: The pluralization of the noun differs from the amount.)</span> sounds wrong, just as the incorrect gender of "la gato" <span class="footnote">(footnote: The article is feminine, but the noun is masculine.)</span> makes native speakers chuckle. Consider also the pronoun "you" or the noun "sheep" which can be singular or plural depending on context.</p>
+<p>Context in Perl is similar. It governs the amount as well as the kind of data to use. Perl will happily attempt to provide exactly what you ask for--provided you do so by choosing the appropriate context.</p>
+<p>Certain Perl operations produce different behaviors when you want zero, one, or many results. A specific construct in Perl may do something different if you write "Do this, but I don't care about any results" compared to "Do this, and I expect multiple results." Other operations allow you to specify whether you expect to work with numeric data, textual data, or true or false data.</p>
+<p>Context can be tricky if you try to write or read Perl code as a series of single expressions extracted from their environments. You may find yourself slapping your forehead after a long debugging session when you discover that your assumptions about context were incorrect. If instead you're cognizant of context, your code will be more correct--and cleaner, flexible, and more concise.</p>
+<h3 id="heading_id_6">Void, Scalar, and List Context</h3>
 <div id="amount_context"></div>
 <div id="icontext__iamount_0"></div>
 <div id="iamount_context_0"></div>
-<p>One of the aspects of context governs <i>how many</i> items you expect. This is <i>amount context</i>. Compare this context to subject-verb number agreement in English. Even if you haven't learned the formal description of the rule, you probably understand the error in the sentence "Perl are a fun language". The rule in Perl is that the number of items you request determines how many you get.</p>
+<p><em>Amount context</em> context governs <em>how many</em> items you expect from an operation. The English language's subject-verb number agreement is a close parallel. Even without knowing the formal description of this linguistic principle, you probably understand the error in the sentence "Perl are a fun language". In Perl, the number of items you request determines how many you get.</p>
 <div id="ivoid_context_0"></div>
 <div id="icontext__ivoid_0"></div>
-<p>Suppose you have a function (<a href="chapter_05.html#functions">Functions</a>(functions)) called <code>some_expensive_operation()</code> which performs an expensive calculation and can produce many, many results. If you call the function on its own and never use its return value, you've called the function in <i>void context</i>:</p>
+<p>Suppose you have a function (<a href="chapter_05.html#functions">Declaring Functions</a>(functions)) called <code>find_chores()</code> which sorts your household todo list in order of task priority. The means by which you call this function determines what it will produce. You may have no time to do chores, in which case calling the function is an attempt to look industrious. You may have enough time to do one task, or you could have a burst of energy on a free weekend and desire to accomplish as much as possible.</p>
+<p>If you call the function on its own and never use its return value, you've called the function in <em>void context</em>:</p>
 <div class="programlisting">
 <pre>
-<code>    some_expensive_operation();</code>
+<code>    find_chores();</code>
 </pre></div>
+<div id="icontext__iscalar_0"></div>
 <div id="iscalar_context_0"></div>
-<p>Assigning the function's return value to a single element evaluates the function in <i>scalar context</i>:</p>
+<p>Assigning the function's return value to a single item (<a href="chapter_03.html#scalars">Scalars</a>(scalars)) evaluates the function in <em>scalar context</em>:</p>
 <div class="programlisting">
 <pre>
-<code>    my $single_result = some_expensive_operation();</code>
+<code>    my $single_result = find_chores();</code>
 </pre></div>
 <div id="ilist_context_0"></div>
-<p>Assigning the results of calling the function to an array (<a href="chapter_03.html#arrays">Arrays</a>(arrays)) or a list, or using it in a list evaluates the function in <i>list context</i>:</p>
+<div id="icontext__ilist_0"></div>
+<p>Assigning the results of calling the function to an array (<a href="chapter_03.html#arrays">Arrays</a>(arrays)) or a list, or using it in a list, evaluates the function in <em>list context</em>:</p>
 <div class="programlisting">
 <pre>
-<code>    my @all_results        = some_expensive_operation();
-    my ($single_element)   = some_expensive_operation();
-    process_list_of_results( some_expensive_operation() );</code>
+<code>    my @all_results             = find_chores();
+    my ($single_element, @rest) = find_chores();
+    process_list_of_results( find_chores() );</code>
 </pre></div>
-<p>The second line of the previous example may look confusing; the parentheses there give a hint to the compiler that although there's only a single scalar, this assignment should occur in list context. It's semantically equivalent to assigning to a scalar and a temporary array, and then throwing away the array, except that no assignment to the array actually occurs:</p>
+<p>The parentheses in the second line of the previous example group the two variable declarations (<a href="chapter_05.html#lexical_scope">Lexical Scope</a>(lexical_scope)) so that assignment will behave as you expect. If <code>@rest</code> were to go unused, you could also correctly write:</p>
 <div class="programlisting">
 <pre>
-<code>    my ($single_element, @rest) = some_expensive_operation();</code>
+<code>    my <strong>(</strong>$single_element<strong>)</strong>   = find_chores();</code>
 </pre></div>
-<div class="sidebar">
-<p>Why is context interesting for functions? Suppose <code>some_expensive_operation()</code> calculates all of the tasks you have to do around the house, sorted in order of their priority. If you have only time to do one task, you can call the function in scalar context to get a useful task--perhaps not necessarily the most important, but important enough without having to go through your whole task list. In list context, the function can perform all of the sorting and searching and comparison and give you an exhaustive list in the proper order. If you want all of that work, but only have time for a couple of tasks, you can use a one or two-element list.</p>
-</div>
-<p>Evaluating a function or expression--except for assignment--in list context can produce confusion. Lists propagate list context to the expressions they contain. Both calls to <code>some_expensive_operation()</code> occur in list context:</p>
+<p>.... in which case the parentheses give a hint to the Perl 5 parser that you intend list context for the assignment even though you assign only one element of a list. This is subtle, but now that you know about it, the difference of amount context between these two statements should be obvious:</p>
 <div class="programlisting">
 <pre>
-<code>    process_list_of_results( some_expensive_operation() );
+<code>    my $scalar_context = find_chores();
+    my <strong>(</strong>$list_context<strong>)</strong> = find_chores();</code>
+</pre></div>
+<p>Evaluating a function or expression--except for assignment--in list context can produce confusion. Lists propagate list context to the expressions they contain. Both of these calls to <code>find_chores()</code> occur in list context:</p>
+<div class="programlisting">
+<pre>
+<code>    process_list_of_results( find_chores() );
 
     my %results =
     (
-        cheap_operation     =&gt; $cheap_operation_results,
-        expensive_operation =&gt; some_expensive_operation(), # OOPS!
+        cheap_operation     =&gt; $cheap_results,
+        expensive_operation =&gt; find_chores(), # OOPS!
     );</code>
 </pre></div>
-<div id="ioperators__iscalar_0"></div>
-<div id="iscalar_0"></div>
-<p>The latter example often surprises novice programmers who expect scalar context for the call. Use the <code>scalar</code> operator to enforce it:</p>
+<div id="ibuiltins__iscalar_0"></div>
+<p>The latter example often surprises novice programmers, as initializing a hash (<a href="chapter_03.html#hashes">Hashes</a>(hashes)) with a list of values imposes list context on <code>find_chores</code>. Use the <code>scalar</code> operator to impose scalar context:</p>
 <div class="programlisting">
 <pre>
 <code>    my %results =
     (
-        cheap_operation     =&gt; $cheap_operation_results,
-        expensive_operation =&gt; scalar some_expensive_operation(),
+        cheap_operation     =&gt; $cheap_results,
+        expensive_operation =&gt; <strong>scalar</strong> find_chores(),
     );</code>
 </pre></div>
-<h5 id="heading_id_7">Numeric, String, and Boolean Context</h5>
+<p>Why does context matter? A context-aware function can examine its calling context and decide how much work it must do. In void context, <code>find_chores()</code> may legitimately do nothing. In scalar context, it can find only the most important task. In list context, it must sort and return the entire list.</p>
+<h3 id="heading_id_7">Numeric, String, and Boolean Context</h3>
 <div id="value_contexts"></div>
 <div id="ivalue_context_0"></div>
 <div id="icontext__ivalue_0"></div>
-<p>Another type of context determines how Perl understands a piece of data--not <i>how many</i> pieces of data you want, but what the data means. You've probably already noticed that Perl's flexible about figuring out if you have a number or a string and converting between the two as you want them. This <i>value context</i> helps to explain how it does so. In exchange for not having to declare (or at least track) explicitly what <i>type</i> of data a variable contains or a function produces, Perl offers specific type contexts that tell the compiler how to treat a given value during an operation.</p>
-<p>Suppose you want to compare the contents of two strings. The <code>eq</code> operator tells you if the strings contain the same information:</p>
+<p>Perl's other context--<em>value context</em>--governs how Perl interprets a piece of data. You've probably already noticed that Perl's flexible about figuring out if you have a number or a string and converting between the two as you want them. In exchange for not having to declare (or at least track) explicitly what <em>type</em> of data a variable contains or a function produces, Perl's type contexts provide hints that tell the compiler how to treat data.</p>
+<div id="ibuiltins__ieq_0"></div>
+<p>Perl will coerce values to specific proper types (<a href="chapter_03.html#coercion">Coercion</a>(coercion)), depending on the operators you use. For example, the <code>eq</code> operator tests that strings contain the same information <em>as strings</em>:</p>
 <div class="programlisting">
 <pre>
 <code>    say "Catastrophic crypto fail!" if $alice eq $bob;</code>
 </pre></div>
-<p>You may have had a baffling experience where you <i>know</i> that the strings are different, but they still compare the same:</p>
+<p>You may have had a baffling experience where you <em>know</em> that the strings are different, but they still compare the same:</p>
 <div class="programlisting">
 <pre>
 <code>    my $alice = 'alice';
-    say "Catastrophic crypto fail!" if $alice == 'Bob';  # OOPS</code>
+    say "Catastrophic crypto fail!" if $alice == 'Bob';</code>
 </pre></div>
 <div id="istring_context_0"></div>
 <div id="inumeric_context_0"></div>
 <div id="icontext__istring_0"></div>
 <div id="icontext__inumeric_0"></div>
-<p>The <code>eq</code> operator treats its operands as strings by enforcing <i>string context</i> on them. The <code>==</code> operator enforces <i>numeric context</i>. The example code fails because the value of both strings when treated as numbers is <code>0</code>.</p>
+<div id="ibuiltins__i6161_0"></div>
+<p>The <code>eq</code> operator treats its operands as strings by enforcing <em>string context</em> on them. The <code>==</code> operator imposes <em>numeric context</em>. In numeric context, both strings evaluate to <code>0</code> (<a href="chapter_03.html#numeric_coercion">Numeric Coercion</a>(numeric_coercion)). Be sure to use the proper operator for the type of context you want.</p>
 <div id="iboolean_context_0"></div>
 <div id="icontext__iboolean_0"></div>
-<p><i>Boolean context</i> occurs when you use a value in a conditional statement. In the previous examples, the <code>if</code> statement evaluated the results of the <code>eq</code> and <code>==</code> operators in boolean context.</p>
-<p>Perl will do its best to coerce values to the proper type (<a href="chapter_03.html#coercion">Coercion</a>(coercion)), depending on the operators you use. Be sure to use the proper operator for the type of context you want.</p>
+<p><em>Boolean context</em> occurs when you use a value in a conditional statement. In the previous examples, <code>if</code> evaluated the results of the <code>eq</code> and <code>==</code> operators in boolean context.</p>
+<div id="icontext__iexplicit_0"></div>
 <p>In rare circumstances, you may need to force an explicit context where no appropriately typed operator exists. To force a numeric context, add zero to a variable. To force a string context, concatenate a variable with the empty string. To force a boolean context, double the negation operator:</p>
 <div class="programlisting">
 <pre>
     my $stringy_x = '' . $x;  # forces string  context
     my $boolean_x =    !!$x;  # forces boolean context</code>
 </pre></div>
-<p>In general, type contexts are less difficult to understand and see than the amount contexts. Once you understand that they exist and know which operators provide which contexts (<a href="chapter_04.html#operator_types">Operator Types</a>(operator_types)), you'll rarely make mistakes with them.</p>
-<h4 id="heading_id_8">Implicit Ideas</h4>
+<p>Type contexts are easier to identify than amount contexts. Once you know which operators provide which contexts (<a href="chapter_04.html#operator_types">Operator Types</a>(operator_types)), you'll rarely make mistakes.</p>
+<h2 id="heading_id_8">Implicit Ideas</h2>
 <div id="implicit_ideas"></div>
-<p>Like many spoken languages, Perl provides linguistic shortcuts. Context is one such feature. Both the compiler and a programmer reading the code can understand the expected number of results or the type of an operation from existing information without adding additional explicit information to disambiguate. Others also exist.</p>
-<h5 id="heading_id_9">The Default Scalar Variable</h5>
-<div id="idefault_scalar_variable_0"></div>
+<p>Context is only one linguistic shortcut in Perl. Programmers who understand these shortcuts can glance at code and instantly understand its most important characteristics. Another important linguistic feature is the Perl equivalent of pronouns.</p>
+<h3 id="heading_id_9">The Default Scalar Variable</h3>
+<div id="default_scalar_variable"></div>
+<div id="idefault_variables__iscalar_0"></div>
+<div id="idefault_variables__i36__0"></div>
 <div id="ivariables__i36__0"></div>
-<div id="i36__0"></div>
-<p>The default scalar variable, <code>$_</code>, is the best example of a linguistic shortcut in Perl. It's most notable in its <i>absence</i>: many of Perl's built in operations perform their work on the contents of <code>$_</code> in the absence of an explicit variable. You can still use <code>$_</code> as the variable, but it's often unnecessary.</p>
-<p>For example, the <code>chomp</code> operator removes any trailing newline sequence from the given string:</p>
+<div id="i36___idefault_scalar_variable_0"></div>
+<p>The <em>default scalar variable</em> (also called the <em>topic variable</em>), <code>$_</code>, is most notable in its <em>absence</em>: many of Perl's builtin operations work on the contents of <code>$_</code> in the absence of an explicit variable. You can still use <code>$_</code> as the variable, but it's often unnecessary.</p>
+<div id="ibuiltins__ichomp_0"></div>
+<div id="ibuiltins__ichr_0"></div>
+<div id="ibuiltins__iord_0"></div>
+<div id="ibuiltins__ilc_0"></div>
+<div id="ibuiltins__ilength_0"></div>
+<div id="ibuiltins__ireverse_0"></div>
+<div id="ibuiltins__iuc_0"></div>
+<p>Many of Perl's scalar operators (including <code>chr</code>, <code>ord</code>, <code>lc</code>, <code>length</code>, <code>reverse</code>, and <code>uc</code>) work on the default scalar variable if you do not provide an alternative. For example, the <code>chomp</code> builtin removes any trailing newline sequence from its operand <span class="footnote">(footnote: See <code>perldoc -f chomp</code> and <code>$/</code> for more precise details of its behavior.)</span>:</p>
 <div class="programlisting">
 <pre>
 <code>    my $uncle = "Bob\n";
-    say "'$uncle'";
     chomp $uncle;
     say "'$uncle'";</code>
 </pre></div>
-<p>Without an explicit variable, <code>chomp</code> removes the trailing newline sequence from <code>$_</code>. Thus, these two lines of code are equivalent:</p>
+<p><code>$_</code> has the same function in Perl as the pronoun <em>it</em> in English. Without an explicit variable, <code>chomp</code> removes the trailing newline sequence from <code>$_</code>. Perl understands what you mean when you say "<code>chomp</code>"; Perl will always chomp <em>it</em>, so these two lines of code are equivalent:</p>
 <div class="programlisting">
 <pre>
 <code>    chomp $_;
     chomp;</code>
 </pre></div>
-<p>Similarly, the <code>say</code> and <code>print</code> builtins operate on <code>$_</code> in the absence of other arguments:</p>
+<div id="ibuiltins__isay_0"></div>
+<div id="ibuiltins__iprint_0"></div>
+<p>Similarly, <code>say</code> and <code>print</code> operate on <code>$_</code> in the absence of other arguments:</p>
 <div class="programlisting">
 <pre>
-<code>    print;  # prints $_ to the currently selected filehandle
-    say;    # prints $_ to the currently selected filehandle
-            # with a trailing newline</code>
+<code>    print;  # prints $_ to the current filehandle
+    say;    # prints "$_\n" to the current filehandle</code>
 </pre></div>
-<p>Perl's regular expression facilities (<a href="chapter_06.html#regular_expressions">Regular Expressions</a>(regular_expressions)) can also operate on <code>$_</code>, performing matches, substitutions, and transliterations:</p>
+<div id="is474747__isubstitution_operator_0"></div>
+<div id="im4747__imatch_operator_0"></div>
+<div id="itr4747__itransliteration_operator_0"></div>
+<p>Perl's regular expression facilities (<a href="chapter_06.html#regex">Regular Expressions and Matching</a>(regex)) default to <code>$_</code> to match, substitute, and transliterate:</p>
 <div class="programlisting">
 <pre>
 <code>    $_ = 'My name is Paquito';
     tr/A-Z/a-z/;
     say;</code>
 </pre></div>
-<div class="author">
-<p>Check how many other string functions this includes?</p>
-</div>
-<p>Many of Perl's scalar operators work on the default scalar variable if you do not provide an alternative.</p>
-<p>Perl's looping directives (<a href="chapter_03.html#looping_directives">Looping Directives</a>(looping_directives)) also set <code>$_</code>, such as <code>for</code> iterating over a list:</p>
+<div id="ibuiltins__ifor_0"></div>
+<p>Perl's looping directives (<a href="chapter_03.html#looping_directives">Looping Directives</a>(looping_directives)) default to using <code>$_</code> as the iteration variable. Consider <code>for</code> iterating over a list:</p>
 <div class="programlisting">
 <pre>
-<code>    say "#<b>$_</b>" for 1 .. 10;
+<code>    say "#<strong>$_</strong>" for 1 .. 10;
 
     for (1 .. 10)
     {
-        say "#<b>$_</b>";
+        say "#<strong>$_</strong>";
     }</code>
 </pre></div>
+<div id="ibuiltins__iwhile_0"></div>
 <p>... or <code>while</code>:</p>
 <div class="programlisting">
 <pre>
         say scalar reverse;
     }</code>
 </pre></div>
+<div id="ibuiltins__imap_0"></div>
 <p>... or <code>map</code> transforming a list:</p>
 <div class="programlisting">
 <pre>
-<code>    my @squares = map { <b>$_</b> * <b>$_</b> } 1 .. 10;
+<code>    my @squares = map { <strong>$_</strong> * <strong>$_</strong> } 1 .. 10;
     say for @squares;</code>
 </pre></div>
+<div id="ibuiltins__igrep_0"></div>
 <p>... or <code>grep</code> filtering a list:</p>
 <div class="programlisting">
 <pre>
-<code>    say 'Brunch time!' if grep { /pancake mix/ } @pantry;</code>
+<code>    say 'Brunch time!'
+        if grep { /pancake mix/ } @pantry;</code>
 </pre></div>
-<p>If you call functions within code that uses <code>$_</code> whether implicitly or explicitly, they may overwrite the value of <code>$_</code>. Similarly, if you write a function which uses <code>$_</code>, you may clobber a caller function's use of <code>$_</code>. Perl 5.10 allows you to use <code>my</code> to declare <code>$_</code> as a lexical variable, which prevents this clobbering behavior. Be wise.</p>
+<p>As English gets confusing when you have too many pronouns and antecedents, you must take care mixing uses of <code>$_</code> implicitly or explicitly. Uncautious simultaneous use of <code>$_</code> may lead to one piece of code silently overwriting the value written by another. If you write a function which uses <code>$_</code>, you may clobber a caller function's use of <code>$_</code>.</p>
+<p>As of Perl 5.10, you may declare <code>$_</code> as a lexical variable (<a href="chapter_05.html#lexical_scope">Lexical Scope</a>(lexical_scope)) to prevent this clobbering behavior:</p>
 <div class="programlisting">
 <pre>
 <code>    while (&lt;STDIN&gt;)
         say "Munged  : $munged";
     }</code>
 </pre></div>
-<p>In this example, if <code>calculate_value()</code> or any other function it happened to call changed <code>$_</code>, it would remain changed throughout the <code>while</code> loop. Adding a <code>my</code> declaration prevents that behavior:</p>
+<p>If <code>calculate_value()</code> or any other function changed <code>$_</code>, that change would persist through that iteration of the loop. Adding a <code>my</code> declaration prevents clobbering an existing instance of <code>$_</code>:</p>
 <div class="programlisting">
 <pre>
 <code>    while (my $_ = &lt;STDIN&gt;)
     }</code>
 </pre></div>
 <p>Use <code>$_</code> as you would the word "it" in formal writing: sparingly, in small and well-defined scopes.</p>
-<h5 id="heading_id_10">The Default Array Variables</h5>
-<div id="idefault_array_variables_0"></div>
+<div class="tip">
+<div id="ibuiltins__i464646_0"></div>
+<p>Perl 5.12 introduced the triple-dot (<code>...</code>) operator as a placeholder for code you intend to fill in later. Perl will parse it as a complete statement, but will throw an exception that you're trying to run unimplemented code if you try to run it. See <code>perldoc perlop</code> for more details.</p>
+</div>
+<h3 id="heading_id_10">The Default Array Variables</h3>
+<div id="default_array_variables"></div>
+<div id="idefault_variables__iarray_0"></div>
+<div id="idefault_variables__i64__0"></div>
 <div id="ivariables__i64__0"></div>
 <div id="i64__0"></div>
-<p>While Perl has a single implicit scalar variable, it has two implicit array variables. Perl passes arguments to functions in an array named <code>@_</code>. Array manipulation operations (<a href="chapter_03.html#arrays">Arrays</a>(arrays)) performed inside functions affect this array by default. Thus, these two snippets of code are equivalent:</p>
+<p>Perl also provides two implicit array variables. Perl passes arguments to functions (<a href="chapter_05.html#functions">Declaring Functions</a>(functions)) in an array named <code>@_</code>. Array manipulation operations (<a href="chapter_03.html#arrays">Arrays</a>(arrays)) inside functions affect this array by default, so these two snippets of code are equivalent:</p>
 <div class="programlisting">
 <pre>
 <code>    sub foo
         ...
     }
 
-    sub foo_explicit
+    sub foo_explicit_args
     {
         my $arg = shift @_;
         ...
     }</code>
 </pre></div>
-<p><i>Unlike</i> <code>$_</code>, Perl automatically localizes <code>@_</code> for you when you call other functions. The array operators <code>shift</code> and <code>pop</code> operate on <code>@_</code> with no other operands provided.</p>
+<div id="ibuiltins__ishift_0"></div>
+<div id="ibuiltins__ipop_0"></div>
+<p>Just as <code>$_</code> corresponds to the pronoun <em>it</em>, <code>@_</code> corresponds to the pronouns <em>they</em> and <em>them</em>. <em>Unlike</em> <code>$_</code>, Perl automatically localizes <code>@_</code> for you when you call other functions. The builtins <code>shift</code> and <code>pop</code> operate on <code>@_</code> with no other operands provided.</p>
+<div id="idefault_variables__i64ARGV_0"></div>
 <div id="ivariables__i64ARGV_0"></div>
 <div id="i64ARGV_0"></div>
-<p>Outside of all functions, the default array variable <code>@ARGV</code> contains the command-line arguments to the program. The same array operators which use <code>@_</code> implicitly <i>within</i> functions use <code>@ARGV</code> implicitly outside of functions. You cannot use <code>@_</code> when you mean <code>@ARGV</code>.</p>
+<p>Outside of all functions, the default array variable <code>@ARGV</code> contains the command-line arguments to the program. Perl's array operations (including <code>shift</code> and <code>pop</code>) operate on <code>@ARGV</code> implicitly outside of functions. You cannot use <code>@_</code> when you mean <code>@ARGV</code>.</p>
+<div class="tip">
+<div id="ibuiltins__ireadline_0"></div>
+<div id="ibuiltins__iglob_0"></div>
+<p>Perl's <code>&lt;$fh&gt;</code> operator is the same as the <code>readline</code> builtin. <code>readline $fh</code> does the same thing as <code>&lt;$fh&gt;</code>. As of Perl 5.10, a bare <code>readline</code> behaves just like <code>&lt;&gt;</code>, so you can now use <code>readline</code> everywhere. For historic reasons, <code>&lt;&gt;</code> is still more common, but consider using <code>readline</code> as a more readable alternative. You probably prefer <code>glob '*.html'</code> to <code>&lt;*.html&gt;</code>, right? It's the same idea.</p>
+</div>
 <div id="inull_filehandle_0"></div>
-<p><code>ARGV</code> has one special case. If you read from the null filehandle <code>&lt;&gt;</code>, Perl will treat every element in <code>@ARGV</code> as the <i>name</i> of a file to open for reading. (If <code>@ARGV</code> is empty, Perl will read from standard input.) This implicit <code>@ARGV</code> behavior is useful for writing short programs, such as this command-line filter which reverses its input:</p>
+<p><code>ARGV</code> has one special case. If you read from the null filehandle <code>&lt;&gt;</code>, Perl will treat every element in <code>@ARGV</code> as the <em>name</em> of a file to open for reading. (If <code>@ARGV</code> is empty, Perl will read from standard input.) This implicit <code>@ARGV</code> behavior is useful for writing short programs, such as this command-line filter which reverses its input:</p>
 <div class="programlisting">
 <pre>
 <code>    while (&lt;&gt;)
         say scalar reverse;
     }</code>
 </pre></div>
-<div class="sidebar">
-<p>Why <code>scalar</code>? <code>say</code> imposes list context on its operands. <code>reverse</code> passes its context on to its operands, treating them as a list in list context and a concatenated string in scalar context. If this sounds confusing, it can be: if Perl 5 arguably should have had different operators for these different operations.</p>
-</div>
+<p>Why <code>scalar</code>? <code>say</code> imposes list context on its operands. <code>reverse</code> passes its context on to its operands, treating them as a list in list context and a concatenated string in scalar context. If the behavior of <code>reverse</code> sounds confusing, your instincts are correct. Perl 5 arguably should have separated "reverse a string" from "reverse a list".</p>
 <p>If you run it with a list of files:</p>
 <div class="screen">
 <pre>
-<code>    $ <b>perl reverse_lines.pl encrypted/*.txt</b></code>
+<code>    $ <strong>perl reverse_lines.pl encrypted/*.txt</strong></code>
 </pre></div>
-<p>... the result will be one long stream of output. Without any arguments, you can provide your own standard input by piping in from another program or typing directly.</p>
+<p>... the result will be one long stream of output. Without any arguments, you can provide your own standard input by piping in from another program or typing directly. Yet Perl is good for far more than small command-line programs....</p>
 </body>
 </html>

src/tutorials/modern-perl/xhtml/chapter_02.html

     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<meta name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
+<meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
 <title></title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" href="../styles/style.css" type="text/css" />
 </head>
 <body>
-<h2 id="heading_id_2">Perl and Its Community</h2>
-<p>One of Larry's main goals for Perl 5 was to encourage Perl development and evolution outside the core distribution. Perl 4 had several forks, because there was no easy way to connect it to a relational database, for example. Larry wanted people to create and maintain their own extensions without fragmenting Perl into thousands of incompatible pidgins.</p>
-<p>You can add technical mechanisms for extensions, but you must also consider community aspects as well. Extensions and enhancements that no one shares are extensions and enhancements that everyone has to build and test and debug and maintain themselves. Yet shared extensions and libraries are worthless if you can't find them, or you can't enhance them, or you don't have permission to use them.</p>
-<p>Fortunately, the Perl community exists. It's strong and healthy. It welcomes willing participants at all levels--and not just for people who produce and share code. Consider taking advantage of the knowledge and experience of countless other Perl programmers, and to share your abilities as well.</p>
+<h1 id="heading_id_2">Perl and Its Community</h1>
+<p>Perl 5's greatest accomplishment is the huge amount of reusable libraries developed for it. Where Perl 4 had forks to connect to databases such as Oracle and Sybase, for example, Perl 5 had a real extension mechanism. Larry wanted people to create and maintain their own extensions without fragmenting Perl into thousands of incompatible pidgins--and it worked.</p>
+<p>That technical accomplishment was almost as important as the growth of a community around Perl 5. <em>People</em> write libraries. <em>People</em> build on the work of other people. <em>People</em> make a community worth joining and preserving and expanding.</p>
+<p>The Perl community is strong and healthy. It welcomes willing participants at all levels, from novices to core developers. Take advantage of the knowledge and experience of countless other Perl programmers, and you'll become a better programmer.</p>
+<h2 id="heading_id_3">The CPAN</h2>
+<div id="cpan"></div>
+<p>Perl 5 is a pragmatic language on its own, yet the ever-pragmatic Perl community has extended that language and made their work available to the world. If you have a problem to solve, chances are someone's already written--and shared--Perl code for it.</p>
+<div id="iCPAN_1"></div>
+<p>Modern Perl programming makes heavy use of the CPAN (<span class="url">http://www.cpan.org/</span>). The Comprehensive Perl Archive Network is an uploading and mirroring system for redistributable, reusable Perl code. It's one of--if not <em>the</em>--largest archives of libraries of code in the world. The CPAN offers libraries for everything from database access to profiling tools to protocols for almost every network device ever created to sound and graphics libraries and wrappers for shared libraries on your system.</p>
+<p>Modern Perl without the CPAN is just another language. Modern Perl with the CPAN is amazing.</p>
+<div id="idistribution_0"></div>
+<div id="imodules_0"></div>
+<p>CPAN mirrors <em>distributions</em>, or collections of reusable Perl code. A single distribution can contain one or more <em>modules</em>, or self-contained libraries of Perl code. Each distribution occupies its own CPAN namespace and provides unique metadata.</p>
+<div class="tip">
+<p>The CPAN <em>adds</em> hundreds of registered contributors and thousands of indexed modules in hundreds of distributions every month. Those numbers do not take into account updates. In late November 2011, search.cpan.org reported 9359 uploaders, 101656 modules, and 23808 distributions (representing growth rates of 11.5%, 19.4%, and 14.3% since the previous edition of this book, respectively).</p>
+</div>
+<div id="isearch46cpan46org_0"></div>
+<p>The CPAN itself is merely a mirroring service. Authors upload distributions and the CPAN sends them to mirror sites, from which users and CPAN clients download, configure, build, test, and install them. The system succeeds because of this simplicity as well as the contributions of thousands of volunteers who've built on this distribution system. In particular, community standards have evolved to identify the attributes and characteristics of well-formed CPAN distributions. These include:</p>
+<ul>
+<li>Standards for automated CPAN installers.</li>
+<li>Standards for metadata to describe what each distribution provides and expects.</li>
+<li>Standards for documentation and licensing.</li>
+</ul>
+<p>Additional CPAN services provide comprehensive automated testing and reporting to improve the quality of packaging and correctness across platforms and Perl versions. Every CPAN distribution has its own ticket queue on <span class="url">http://rt.cpan.org/</span> for reporting bugs and working with authors. CPAN sites also link to previous distribution versions, module ratings, documentation annotations, and more. All of this is available from <span class="url">http://search.cpan.org/</span>.</p>
+<div id="iCPAN__iCPAN46pm_0"></div>
+<div id="iCPAN__iCPANPLUS_0"></div>
+<p>Modern Perl installations include two clients to connect to, search, download, build, test, and install CPAN distributions, CPAN.pm and CPANPLUS. For the most part, each of these clients is equivalent for basic installation. This book recommends the use of CPAN.pm solely due to its ubiquity. With a recent version (as of this writing, 1.9800 is the latest stable release), module installation is reasonably easy. Start the client with:</p>
+<div class="screen">
+<pre>
+<code>    $ <strong>cpan</strong></code>
+</pre></div>
+<p>To install a distribution within the client:</p>
+<div class="screen">
+<pre>
+<code>    $ <strong>cpan</strong>
+    cpan[1]&gt; <strong>install Modern::Perl</strong></code>
+</pre></div>
+<p>... or to install directly from the command line:</p>
+<div class="screen">
+<pre>
+<code>    $ <strong>cpan Modern::Perl</strong></code>
+</pre></div>
+<div id="iCPAN__iCPAN46pm_1"></div>
+<p>Eric Wilhelm's tutorial on configuring CPAN.pm <span class="footnote">(footnote: <span class="url">http://learnperl.scratchcomputing.com/tutorials/configuration/</span>)</span> includes a great troubleshooting section.</p>
+<div class="sidebar">
+<p>Even though the CPAN client is a core module for the Perl 5 distribution, you will likely need to install standard development tools such as a <code>make</code> utility and possibly a C compiler. Windows users, see Strawberry Perl (<span class="url">http://strawberryperl.com/</span>) and Strawberry Perl Professional. Mac OS X users must install XCode. Unix and Unix-like users often have these tools available (though Debian and Ubuntu users should install <code>build-essential</code>).</p>
+</div>
+<h3 id="heading_id_4">CPAN Management Tools</h3>
+<p>If your operating system provides its own installation of Perl 5, that version may be out of date or it may have its own dependencies on specific versions of CPAN distributions. Serious Perl developers often construct virtual walls between the system Perl and their development Perl installations. Several projects help to make this possible.</p>
+<p><code>App::cpanminus</code> is a relatively new CPAN client with goals of speed, simplicity, and zero configuration. Install it with <code>cpan App::cpanminus</code>, or:</p>
+<div class="screen">
+<pre>
+<code>    $ <strong>curl -LO http://xrl.us/cpanm</strong>
+    $ <strong>chmod +x cpanm</strong></code>
+</pre></div>
+<p><code>App::perlbrew</code> is a system to manage and to switch between your own installations of multiple versions and configurations of Perl. Installation is as easy as:</p>
+<div class="screen">
+<pre>
+<code>    $ <strong>curl -LO http://xrl.us/perlbrew</strong>
+    $ <strong>chmod +x perlbrew</strong>
+    $ <strong>./perlbrew install</strong>
+    $ <strong>perldoc App::perlbrew</strong></code>
+</pre></div>
+<div id="iCPAN__ilocal5858lib_0"></div>
+<div id="iCPAN__iApp5858local5858lib5858helper_0"></div>
+<p>The <code>local::lib</code> CPAN distribution allows you to install and to manage distributions in your own user directory, rather than for the system as a whole. This is an effective way to maintain CPAN distributions without affecting other users. Installation is somewhat more involved than the previous two distributions, though <code>App::local::lib::helper</code> can simplify the process. See <span class="url">http://search.cpan.org/perldoc?local::lib</span> and <span class="url">http://search.cpan.org/perldoc?App::local::lib::helper</span> for more details.</p>
+<p>All three projects tend to assume a Unix-like environment (such as a GNU/Linux distribution or even Mac OS X). Windows users, see the Padre all-in-one download (<span class="url">http://padre.perlide.org/download.html</span>).</p>
 <div id="perl_community"></div>
-<h3 id="heading_id_3">Community Sites</h3>
+<h2 id="heading_id_5">Community Sites</h2>
 <div id="iperl46org_0"></div>
 <div id="iwebsites__iperl46org_0"></div>
-<p>Perl's homepage is <span class="url">http://www.perl.org/</span>. This site hosts documentation, source code, tutorials, mailing lists, and several important community projects. If you're new to Perl, the Perl beginners mailing list is a friendly place to ask novice questions and get accurate and helpful answers. See <span class="url">http://beginners.perl.org/</span>.</p>
-<p>An important subdomain of note is <span class="url">http://dev.perl.org/</span>, a central site for core development of Perl 5, Perl 6 <span class="footnote">(footnote: The main Perl 6 site is <span class="url">http://www.perl6.org/</span>)</span>, and even Perl 1.</p>
-<div id="iPerl_Pub_0"></div>
-<p>Perl.com publishes several articles and tutorials about Perl programming every month. Its archives reach back into the 20th century. See <span class="url">http://www.perl.com/</span>.</p>
+<p>Perl's homepage at <span class="url">http://www.perl.org/</span> links to Perl documentation, source code, tutorials, mailing lists, and several important community projects. If you're new to Perl, the Perl beginners mailing list is a friendly place to ask novice questions and get accurate and helpful answers. See <span class="url">http://learn.perl.org/faq/beginners.html</span>.</p>
+<p>The home of Perl development is <span class="url">http://dev.perl.org/</span>, which links to relevant resources for core development of Perl 5 and Perl 6 <span class="footnote">(footnote: Though see also <span class="url">http://www.perl6.org/</span>)</span>.</p>
+<div id="iperl46com_0"></div>
+<div id="iwebsites__iperl46com_0"></div>
+<p>Perl.com publishes articles and tutorials about Perl and its culture. Its archives reach back into the 20th century. See <span class="url">http://www.perl.com/</span>.</p>
 <div id="icpan46org_0"></div>
 <div id="iwebsites__icpan46org_0"></div>
-<p>The CPAN's (<a href="chapter_02.html#cpan">The CPAN</a>(cpan)) central location is <span class="url">http://www.cpan.org/</span>, though experienced users spend more time on <span class="url">http://search.cpan.org/</span>. This central software distribution hub of reusable, free Perl code is an essential part of the Perl community.</p>
+<div id="iMetaCPAN_0"></div>
+<div id="iwebsites__iMetaCPAN_0"></div>
+<p>The CPAN's (<a href="chapter_02.html#cpan">The CPAN</a>(cpan)) central location is <span class="url">http://www.cpan.org/</span>, though experienced users spend more time on <span class="url">http://search.cpan.org/</span>. This central software distribution hub of reusable, free Perl code is an essential part of the Perl community. MetaCPAN (<span class="url">https://metacpan.org/</span>) is a recent alternative front end to the CPAN.</p>
 <div id="iPerlMonks_0"></div>
-<p>PerlMonks, at <span class="url">http://perlmonks.org/</span>, is a venerable community site devoted to questions and answers and other discussions about Perl programming. It celebrated its tenth anniversary in December 2009, making it one of the longest lasting web communities dedicated to any programming language.</p>
-<div id="iuse_Perl59_0"></div>
+<div id="iwebsites__iPerlMonks_0"></div>
+<p>PerlMonks, at <span class="url">http://perlmonks.org/</span>, is a community site devoted to discussions about Perl programming. Its eleven year history makes it one of the most venerable question and answer sites for any programming language.</p>
 <div id="iblogs46perl46org_0"></div>
-<p>Several community sites offer news and commentary. The oldest is <span class="url">http://use.perl.org/</span>; it has offered custom journals for many years. Several well-known Perl hackers write there. <span class="url">http://blogs.perl.org/</span> is a newer community site dedicated to blogging about Perl.</p>
+<div id="iwebsites__iblogs46perl46org_0"></div>
+<p>Several community sites offer news and commentary. <span class="url">http://blogs.perl.org/</span> is a free blog platform open to any Perl community member.</p>
 <div id="iEnlightened_Perl_Organization_0"></div>
-<p>Other sites aggregate the Perl-related musings of Perl hackers, including <span class="url">http://perlsphere.net/</span>, <span class="url">http://planet.perl.org/</span>, and <span class="url">http://ironman.enlightenedperl.org/</span>. The latter is part of an initiative from the Enlightened Perl Organization (<span class="url">http://enlightenedperl.org/</span>) to increase the amount of and improve the quality of Perl publishing on the web.</p>
+<div id="iPlanet_Perl_0"></div>
+<div id="iPlanet_Perl_Iron_Man_0"></div>
+<div id="iwebsites__iPlanet_Perl_0"></div>
+<div id="iwebsites__iPlanet_Perl_Iron_Man_0"></div>
+<p>Other sites aggregate the musings of Perl hackers, including <span class="url">http://perlsphere.net/</span>, <span class="url">http://planet.perl.org/</span>, and <span class="url">http://ironman.enlightenedperl.org/</span>. The latter is part of an initiative from the Enlightened Perl Organization (<span class="url">http://enlightenedperl.org/</span>) to increase the amount and improve the quality of Perl publishing on the web.</p>
 <div id="iPerl_Buzz_0"></div>
-<p>Perl Buzz (<span class="url">http://perlbuzz.com/</span>) collects and republishes some of the most interesting and useful Perl news on a regular basis.</p>
-<h3 id="heading_id_4">Development Sites</h3>
+<div id="iwebsites__iPerl_Buzz_0"></div>
+<div id="iPerl_Weekly_0"></div>
+<div id="iwebsites__iPerl_Weekly_0"></div>
+<p>Perl Buzz (<span class="url">http://perlbuzz.com/</span>) collects and republishes some of the most interesting and useful Perl news on a regular basis. Perl Weekly (<span class="url">http://perlweekly.com/</span>) offers a weekly take on news from the Perl world.</p>
+<h2 id="heading_id_6">Development Sites</h2>
 <div id="iRT_0"></div>
 <div id="iBest_Practical_0"></div>
 <p>Best Practical Solutions (<span class="url">http://bestpractical.com/</span>) maintains an installation of their popular request tracking system, RT, for CPAN authors as well as Perl 5 and Perl 6 development. Every CPAN distribution has its own RT queue, linked from <code>search.cpan.org</code> and available on <span class="url">http://rt.cpan.org/</span>. Perl 5 and Perl 6 have separate RT queues available on <span class="url">http://rt.perl.org/</span>.</p>
 <div id="iPerl_5_Porters_0"></div>
 <div id="ip5p_0"></div>
-<p>The Perl 5 Porters (also known as <i>p5p</i>) mailing list is the central point for Perl 5 development discussion. See <span class="url">http://lists.cpan.org/showlist.cgi?name=perl5-porters</span>.</p>
+<p>The Perl 5 Porters (or <em>p5p</em>) mailing list is the focal point of the development of Perl 5 itself. See <span class="url">http://lists.cpan.org/showlist.cgi?name=perl5-porters</span>.</p>
 <div id="iTPF_0"></div>
 <div id="iThe_Perl_Foundation_0"></div>
-<div id="iTPF_wiki_0"></div>
+<div id="iTPF__iwiki_0"></div>
+<div id="iwebsites__iTPF_wiki_0"></div>
 <p>The Perl Foundation (<span class="url">http://www.perlfoundation.org/</span>) hosts a wiki for all things Perl 5. See <span class="url">http://www.perlfoundation.org/perl5</span>.</p>
 <div id="iGithub_0"></div>
-<div id="iGitpan_0"></div>
-<p>Many Perl hackers use Github (<span class="url">http://github.com/</span>) to host their projects <span class="footnote">(footnote: ... including the drafts of this book at <span class="url">http://github.com/chromatic/modern_perl_book/</span>))</span>. One particularly notable page on Github is Gitpan, which hosts Git repositories chronicling the complete history of every distribution on the CPAN. See <span class="url">http://github.com/gitpan/</span>.</p>
-<h3 id="heading_id_5">Events</h3>
+<div id="igitpan_0"></div>
+<div id="iwebsites__igitpan_0"></div>
+<p>Many Perl hackers use Github (<span class="url">http://github.com/</span>) to host their projects <span class="footnote">(footnote: ... including the sources of this book at <span class="url">http://github.com/chromatic/modern_perl_book/</span>)</span>. See especially Gitpan (<span class="url">http://github.com/gitpan/</span>), which hosts Git repositories chronicling the complete history of every distribution on the CPAN.</p>
+<div class="tip">
+<div id="iCPAN__iGit5858CPAN5858Patch_0"></div>
+<div id="iChampoux44_Yanick_0"></div>
+<p>GitPAN receives infrequent updates. As an alternative, consider using Yanick Champoux's wonderful <code>Git::CPAN::Patch</code> module.</p>
+</div>
+<h2 id="heading_id_7">Events</h2>
 <div id="iYAPC_0"></div>
-<p>There are plenty of events in the physical world as well. The Perl community holds a lot of conferences, workshops, and seminars. In particular, the community-run YAPC--Yet Another Perl Conference--is a successful, local, low-cost conference model held on multiple continents. See <span class="url">http://yapc.org/</span>.</p>
+<p>The Perl community holds countless conferences, workshops, seminars, and meetings. In particular, the community-run YAPC--Yet Another Perl Conference--is a successful, local, low-cost conference model held on multiple continents. See <span class="url">http://yapc.org/</span>.</p>
 <p>The Perl Foundation wiki lists other events at <span class="url">http://www.perlfoundation.org/perl5/index.cgi?perl_events</span>.</p>
 <div id="iPerl_Mongers_0"></div>
-<p>There are also hundreds of local Perl Mongers groups which get together frequently for technical talks and social interaction. See <span class="url">http://www.pm.org/</span>.</p>
-<h3 id="heading_id_6">IRC</h3>
+<p>Hundreds of local Perl Mongers groups get together frequently for technical talks and social interaction. See <span class="url">http://www.pm.org/</span>.</p>
+<h2 id="heading_id_8">IRC</h2>
 <div id="iIRC_0"></div>
 <div id="iIRC__i35moose_0"></div>
 <div id="iIRC__i35catalyst_0"></div>
 <div id="iIRC__i35perl45help_0"></div>
 <div id="iIRC__i35perl_0"></div>
-<p>When Perl mongers aren't at local meetups or conferences or workshops, many collaborate and chat online through IRC, a textual group chat system from the early days of the Internet. Many of the most popular and useful Perl projects have their own IRC channels, such as <i>#moose</i> or <i>#catalyst</i>.</p>
-<p>The main server for Perl community is <span class="url">irc://irc.perl.org/</span>. Other notable channels include <i>#perl-help</i>, for general assistance on Perl programming, and <i>#perl-qa</i>, devoted to testing and other quality issues. Be aware that the channel <i>#perl</i> is <i>not</i> for general help--instead, it's a general purpose room for discussing whatever its participants want to discuss <span class="footnote">(footnote: ... and it's not often friendly to people who ask basic programming questions.)</span>.</p>
-<h3 id="heading_id_7">The CPAN</h3>
-<div id="cpan"></div>
-<p>Perl 5 is a pragmatic language. It'll help you get your work done. Yet the ever-pragmatic Perl community has extended that language and made their work available to the world. If you have a problem to solve, chances are someone's already uploaded code to the CPAN for it.</p>
-<p>The line between a modern language and its libraries is fuzzy. Is a language only syntax? Is it the core libraries? Is it the availability of external libraries and the ease at which you can use them within your own projects?</p>
-<div id="iCPAN_0"></div>
-<p>Regardless of how you answer those questions for any other language, modern Perl programming makes heavy use of the CPAN (<span class="url">http://www.cpan.org/</span>). The CPAN, or Comprehensive Perl Archive Network, is an uploading and mirroring system for redistributable, reusable Perl code. It's one of--if not <i>the</i>--largest archives of libraries of code in the world.</p>
-<div id="idistribution_0"></div>
-<div id="imodule_0"></div>
-<p>CPAN mirrors <i>distributions</i>, which tend to be collections of reusable Perl code. A single distribution can contain one or more <i>modules</i>, or self-contained libraries of Perl code. Each distribution lives in its own namespace on the CPAN and contains its own metadata. You can build, install, test, and update each distribution. Distributions may depend on other distributions. For this reason, installing distributions through a CPAN client is often simpler than doing so manually.</p>
-<div class="sidebar">
-<p>The CPAN <i>adds</i> hundreds of registered contributors and thousands of indexed modules in hundreds of distributions every month. Those numbers do not take into account updates. In late April 2010, search.cpan.org reported 8156 uploaders, 81436 modules, and 20065 distributions.</p>
-</div>
-<div id="isearch46cpan46org_0"></div>
-<p>The CPAN itself is merely a mirroring service. Authors upload distributions containing modules, and the CPAN sends them to mirror sites, from which users and CPAN clients download, configure, build, test, and install distributions. Yet the CPAN has succeeded because of this simplicity, and because of the contributions of thousands of volunteers who've built on this distribution system to produce something greater. In particular, community standards have evolved to identify the attributes and characteristics of well-formed CPAN distributions. These include:</p>
-<ul>
-<li>Standards for installation to work with automated CPAN installers.</li>
-<li>Standards for metadata to describe what each distribution includes and any dependencies of the distribution.</li>
-<li>Standards for documentation and licensing to describe what the distribution does and how you may use it.</li>
-</ul>
-<p>Additional CPAN services provide comprehensive automated testing and reporting of every CPAN distribution for adherence to packaging and distribution guidelines and correctness of behavior on various platforms and versions of Perl. Every CPAN distribution has its own ticket queue on <span class="url">http://rt.cpan.org/</span> for reporting bugs and working with authors. Distributions also have historical versions available on the CPAN, ratings, annotations for the documentation, and other useful information. All of this is available from <span class="url">http://search.cpan.org/</span>.</p>
-<div id="iCPAN46pm_0"></div>
-<div id="iCPANPLUS_0"></div>
-<p>Modern Perl installations include two clients to connect to, search, download, build, test, and install CPAN distributions, CPAN.pm and CPANPLUS. They behave equivalently; their use is a matter of taste. This book recommends the use of CPAN.pm solely due to its ubiquity.</p>
-<p>If you use a recent version of CPAN.pm (as of this writing, 1.9402 is the latest stable release), CPAN.pm configuration is largely decision-free. For any complete installation of Perl, you may start the client with:</p>
-<div class="programlisting">
-<pre>
-<code>    $ <b>cpan</b></code>
-</pre></div>
-<p>To install a distribution:</p>
-<div class="programlisting">
-<pre>
-<code>    $ <b>cpan Modern::Perl</b></code>
-</pre></div>
-<div id="iEric_Wilhelm_0"></div>
-<div id="iCPAN46pm__iconfiguration_0"></div>
-<div id="iCPAN46pm__itroubleshooting_0"></div>
-<p>Eric Wilhelm's excellent tutorial on configuring CPAN.pm (<span class="url">http://learnperl.scratchcomputing.com/tutorials/configuration/</span>) is worth reading twice, especially its section on troubleshooting.</p>
-<div class="sidebar">
-<p>Even though the CPAN client is a core module for the Perl 5 distribution, you may also have to install standard development tools such as a <code>make</code> utility and possibly a C compiler to install all of the distributions you want. Windows users, see Strawberry Perl (<span class="url">http://strawberryperl.com/</span>) and Strawberry Perl Professional. Mac OS X users need their developer tools installed. Unix and Unix-like users, consult your local system administrator.</p>
-</div>
-<p>For your work setting up a CPAN client and an environment to build and install distributions, you get access to libraries for everything from database access to profiling tools to protocols for almost every network device ever created to sound and graphics libraries and wrappers for shared libraries on your system.</p>
-<p>Modern Perl without the CPAN is just another language. Modern Perl with the CPAN is amazing.</p>
-<div class="sidebar">
-<p>Serious Perl developers often manage their own Perl library paths or even full installations. Several projects help to make this possible.</p>
-<p><code>App::cpanminus</code> is a new CPAN client with goals of speed, simplicity, and zero configuration. Installation is as easy as:</p>
-<div class="programlisting">
-<pre>
-<code>    $ curl -LO http://xrl.us/cpanm
-    $ chmod +x cpanm</code>
-</pre></div>
-<p><code>App::perlbrew</code> is a system to manage and to switch between your own installations of multiple versions and configurations of Perl. Installation is as easy as:</p>
-<div class="programlisting">
-<pre>
-<code>    $ curl -LO http://xrl.us/perlbrew
-    $ chmod +x perlbrew
-    $ ./perlbrew install
-    $ perldoc App::perlbrew</code>
-</pre></div>
-<p>The <code>local::lib</code> CPAN distribution allows you to install and to manage distributions in your own user directory, rather than for the system as a whole. This is an effective way to maintain CPAN distributions without affecting other users. Installation is somewhat more involved than the previous two distributions. See <span class="url">http://search.cpan.org/perldoc?local::lib</span> for more details.</p>
-<p>All three distributions projects tend to assume a Unix-like environment (such as a GNU/Linux distribution or even Mac OS X). Windows users, see the Padre all-in-one download (<span class="url">http://padre.perlide.org/download.html</span>).</p>
-</div>
+<p>When Perl mongers can't meet in person, many collaborate and chat online through the textual chat system known as IRC. Many of the most popular and useful Perl projects have their own IRC channels, such as <em>#moose</em> and <em>#catalyst</em>.</p>
+<p>The main server for Perl community is <span class="url">irc://irc.perl.org/</span>. Notable channels include <em>#perl-help</em>, for general assistance on Perl programming, and <em>#perl-qa</em>, devoted to testing and other quality issues. Be aware that the channel <em>#perl</em> is a general purpose channel for discussing whatever its participants want to discuss <span class="footnote">(footnote: ... and, as such, it's not primarily a helpdesk.)</span>.</p>
 </body>
 </html>

src/tutorials/modern-perl/xhtml/chapter_03.html

     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-<meta name="generator" content="HTML Tidy for Linux/x86 (vers 25 March 2009), see www.w3.org" />
+<meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
 <title></title>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" href="../styles/style.css" type="text/css" />
 </head>
 <body>
-<h2 id="heading_id_2">The Perl Language</h2>
-<p>The Perl language has several smaller parts which combine to form its syntax. Unlike spoken language, where nuance and tone of voice and intuition allow people to communicate despite slight misunderstandings and fuzzy concepts, computers and source code require precision. You can write effective Perl code without knowing every detail of every language feature, but you must understand how they work together to write Perl code well.</p>
-<h3 id="heading_id_3">Names</h3>
+<h1 id="heading_id_2">The Perl Language</h1>
+<p>Like a spoken language, the whole of Perl is a combination of several smaller but interrelated parts. Unlike spoken language, where nuance and tone of voice and intuition allow people to communicate despite slight misunderstandings and fuzzy concepts, computers and source code require precision. You can write effective Perl code without knowing every detail of every language feature, but you must understand how they work together to write Perl code well.</p>
+<h2 id="heading_id_3">Names</h2>
 <div id="names"></div>
 <div id="inames_0"></div>
 <div id="iidentifiers_0"></div>
-<p><i>Names</i> (or <i>identifiers</i>) are everywhere in Perl programs: variables, functions, packages, classes, and even filehandles have names. These names all start with a letter or an underscore. They may optionally include any combination of letters, numbers, and underscores. When the <code>utf8</code> pragma (<a href="chapter_09.html#pragmas">Pragmas</a>(pragmas), <a href="chapter_03.html#unicode">Unicode and Strings</a>(unicode)) is in effect, you may use any valid UTF-8 characters in identifiers. These are all valid Perl identifiers:</p>
+<p><em>Names</em> (or <em>identifiers</em>) are everywhere in Perl programs: variables, functions, packages, classes, and even filehandles. These names all begin with a letter or an underscore and may optionally include any combination of letters, numbers, and underscores. When the <code>utf8</code> pragma (<a href="chapter_03.html#unicode">Unicode and Strings</a>(unicode)) is in effect, you may use any UTF-8 word characters in identifiers. These are all valid Perl identifiers:</p>
 <div class="programlisting">
 <pre>
 <code>    my $name;
 
     sub anAwkwardName3;
 
-    # with <code>use utf8;</code> enabled
+    # with use utf8; enabled
     package Ingy::Döt::Net;</code>
 </pre></div>
 <p>These are invalid Perl identifiers:</p>
     package a-lisp-style-name;</code>
 </pre></div>
 <div id="isymbolic_lookups_0"></div>
-<p>These rules only apply to names which appear in literal form in source code; that is, if you've typed it directly like <code>sub fetch_pie</code> or <code>my $wafflemaker</code>.</p>
-<p>Perl's dynamic nature makes it possible to refer to entities with names generated at runtime or provided as input to a program. These are <i>symbolic lookups</i>. You get more flexibility this way at the expense of some safety. In particular, invoking functions or methods indirectly or looking up namespaced symbols lets you bypass Perl's parser, which is the only part of Perl that enforces these grammatic rules. Be aware that doing so can produce confusing code; a hash (<a href="chapter_03.html#hashes">Hashes</a>(hashes)) or nested data structure (<a href="chapter_03.html#nested_data_structures">Nested Data Structures</a>(nested_data_structures)) is often clearer.</p>
-<h4 id="heading_id_4">Variable Names and Sigils</h4>
+<p><em>Names exist primarily for the benefit of the programmer</em>. These rules apply only to literal names which appear as-is in your source code, such as <code>sub fetch_pie</code> or <code>my $waffleiron</code>. Only Perl's parser enforces the rules about identifier names.</p>
+<p>Perl's dynamic nature allows you to refer to entities with names generated at runtime or provided as input to a program. These <em>symbolic lookups</em> provide flexibility at the expense of some safety. In particular, invoking functions or methods indirectly or looking up symbols in a namespace lets you bypass Perl's parser.</p>
+<p>Doing so can produce confusing code. As Mark Jason Dominus recommends so effectively <span class="footnote">(footnote: <span class="url">http://perl.plover.com/varvarname.html</span>)</span>, use a hash (<a href="chapter_03.html#hashes">Hashes</a>(hashes)) or nested data structure (<a href="chapter_03.html#nested_data_structures">Nested Data Structures</a>(nested_data_structures)).</p>
+<h3 id="heading_id_4">Variable Names and Sigils</h3>
 <div id="ivariables__inames_0"></div>
 <div id="iscalar_variables_0"></div>
 <div id="ivariables__iscalars_0"></div>
 <div id="iscalars_0"></div>
-<div id="iarray_variables_0"></div>
+<div id="iarrays_0"></div>
 <div id="ivariables__iarrays_0"></div>
-<div id="ihash_variables_0"></div>
+<div id="ihashes_0"></div>
 <div id="ivariables__ihashes_0"></div>
-<p><i>Variable names</i> always have a leading sigil which indicates the type of the variable's value. <i>Scalar variables</i> (<a href="chapter_03.html#scalars">Scalars</a>(scalars)) have a leading dollar sign (<code>$</code>) character. <i>Array variables</i> (<a href="chapter_03.html#arrays">Arrays</a>(arrays)) have a leading at sign (<code>@</code>) character. <i>Hash variables</i> (<a href="chapter_03.html#hashes">Hashes</a>(hashes)) have a leading percent sign (<code>%</code>) character:</p>
+<div id="isigil_0"></div>
+<p><em>Variable names</em> always have a leading <em>sigil</em> (or symbol) which indicates the type of the variable's value. <em>Scalar variables</em> (<a href="chapter_03.html#scalars">Scalars</a>(scalars)) use the dollar sign (<code>$</code>). <em>Array variables</em> (<a href="chapter_03.html#arrays">Arrays</a>(arrays)) use the at sign (<code>@</code>). <em>Hash variables</em> (<a href="chapter_03.html#hashes">Hashes</a>(hashes)) use the percent sign (<code>%</code>):</p>
 <div class="programlisting">
 <pre>
 <code>    my $scalar;
     my @array;
     my %hash;</code>
 </pre></div>
-<p>These sigils offer a sort of namespacing for the variables, where it's possible (though often confusing) to have variables of the same name but different types:</p>
+<p>These sigils provide a visual namespacing for variable names. It's possible--though confusing--to declare multiple variables of the same name with different types:</p>
 <div class="programlisting">
 <pre>
 <code>    my ($bad_name, @bad_name, %bad_name);</code>
 </pre></div>
-<p>Perl won't get confused, but people reading the code will.</p>
+<p>Though Perl won't get confused, people reading this code will.</p>
 <div id="ivariant_sigils_0"></div>
-<p>Perl 5 uses <i>variant sigils</i>, where the sigil on a variable may change depending on what you do with it. For example, to access a (scalar) element of an array or a hash, the sigil changes to the dollar sign (<code>$</code>) character:</p>
+<p>Perl 5's sigils are <em>variant sigils</em>. As context determines how many items you expect from an operation or what type of data you expect to get, so the sigil governs how you manipulate the data of a variable. For example, to access a single element of an array or a hash, you must use the scalar sigil (<code>$</code>):</p>
 <div class="programlisting">
 <pre>
 <code>    my $hash_element  = $hash{ $key };
 </pre></div>
 <div id="ilvalue_0"></div>
 <div id="irvalue_0"></div>
-<p>In the latter two lines, using a scalar element of an aggregate as an <i>lvalue</i> (the target of an assignment, on the left side of the <code>=</code> character) imposes scalar context (<a href="chapter_01.html#context_philosophy">Context</a>(context_philosophy)) on the <i>rvalue</i> (the value assigned, on the right side of the <code>=</code> character).</p>
-<div id="islicing_0"></div>
-<p>Similarly, accessing multiple elements of a hash or an array--an operation known as <i>slicing</i>--uses the at symbol (<code>@</code>) as the leading sigil and enforces list context when used as an lvalue:</p>
+<p>The parallel with amount context is important. Using a scalar element of an aggregate as an <em>lvalue</em> (the target of an assignment, on the left side of the <code>=</code> character) imposes scalar context (<a href="chapter_01.html#context_philosophy">Context</a>(context_philosophy)) on the <em>rvalue</em> (the value assigned, on the right side of the <code>=</code> character).</p>
+<div id="islices_0"></div>
+<p>Similarly, accessing multiple elements of a hash or an array--an operation known as <em>slicing</em>--uses the at symbol (<code>@</code>) and imposes list context <span class="footnote">(footnote: ... even if the list itself has zero or one elements)</span>:</p>
 <div class="programlisting">
 <pre>
 <code>    my @hash_elements  = @hash{ @keys };
-    my @array_elements = @array[ @indexes ];</code>
+    my @array_elements = @array[ @indexes ];
+
+    my %hash;
+    @hash{ @keys }     = @values;</code>
 </pre></div>
-<div class="author">
-<p>Add an example that uses a hash slice as an lvalue? I.E.</p>
-<p>my %hash; @hash{ @keys } = @values;</p>
-</div>
 <p>The most reliable way to determine the type of a variable--scalar, array, or hash--is to look at the operations performed on it. Scalars support all basic operations, such as string, numeric, and boolean manipulations. Arrays support indexed access through square brackets. Hashes support keyed access through curly brackets.</p>
-<h4 id="heading_id_5">Package-Qualified Names</h4>
+<h3 id="heading_id_5">Namespaces</h3>
 <div id="ifully45qualified_name_0"></div>
-<p>Occasionally you may need to refer to functions or variables in a separate namespace. Often you will need to refer to a class by its <i>fully-qualified name</i>. These names are collections of package names joined by double colons (<code>::</code>). That is, <code>My::Fine::Package</code> refers to a logical collection of variables and functions.</p>
-<p>While the standard naming rules apply to package names, by convention user-defined packages all start with uppercase letters. The Perl core reserves lowercase package names for built-in pragmas (<a href="chapter_09.html#pragmas">Pragmas</a>(pragmas)), such as <code>strict</code> and <code>warnings</code>. This is a policy enforced by community guidelines, rather than technical mechanisms.</p>
-<p>Namespaces do not nest in Perl 5. The relationship between between <code>Some::Package</code> and <code>Some::Package::Refinement</code> is only a storage mechanism, with no further implications on the relationships between parent and child or sibling packages. When Perl looks up a symbol in <code>Some::Package::Refinement</code>, it looks in the <code>main::</code> symbol table for a symbol representing the <code>Some::</code> namespace, then in there for the <code>Package::</code> namespace, and so on. It's your responsibility to make any <i>logical</i> relationships between entities obvious when you choose names and organize your code.</p>
-<h3 id="heading_id_6">Variables</h3>
+<div id="inamespaces_0"></div>
+<p>Perl provides a mechanism to group similar functions and variables into their own unique named spaces--<em>namespaces</em> (<a href="chapter_03.html#packages">Packages</a>(packages)). A namespace is a named collection of symbols. Perl allows multi-level namespaces, with names joined by double colons (<code>::</code>), where <code>DessertShop::IceCream</code> refers to a logical collection of related variables and functions, such as <code>scoop()</code> and <code>pour_hot_fudge()</code>.</p>
+<p>Within a namespace, you may use the short name of its members. Outside of the namespace, refer to a member using its <em>fully-qualified name</em>. That is, within <code>DessertShop::IceCream</code>, <code>add_sprinkles()</code> refers to the same function as does <code>DessertShop::IceCream::add_sprinkles()</code> outside of the namespace.</p>
+<p>While standard naming rules apply to package names, by convention user-defined packages all start with uppercase letters. The Perl core reserves lowercase package names for core pragmas (<a href="chapter_08.html#pragmas">Pragmas</a>(pragmas)), such as <code>strict</code> and <code>warnings</code>. This is a policy enforced primarily by community guidelines.</p>
+<p>All namespaces in Perl 5 are globally visible. When Perl looks up a symbol in <code>DessertShop::IceCream::Freezer</code>, it looks in the <code>main::</code> symbol table for a symbol representing the <code>DessertShop::</code> namespace, then in there for the <code>IceCream::</code> namespace, and so on. The <code>Freezer::</code> is visible from outside of the <code>IceCream::</code> namespace. The nesting of the former within the latter is only a storage mechanism, and implies nothing further about relationships between parent and child or sibling packages. Only a programmer can make <em>logical</em> relationships between entities obvious--by choosing good names and organizing them well.</p>
+<h2 id="heading_id_6">Variables</h2>
 <div id="variables"></div>
 <div id="ivariable_0"></div>
-<p>A <i>variable</i> in Perl is a storage location for a value (<a href="chapter_03.html#values">Values</a>(values)). You can work with values directly, but all but the most trivial code works with variables. A variable is a level of indirection; it's easier to explain the Pythagorean theorem in terms of the variables <code>a</code>, <code>b</code>, and <code>c</code> than with the side lengths of every right triangle you can imagine. This may seem basic and obvious, but to write robust, well-designed, testable, and composable programs, you must identify and exploit points of genericity wherever possible.</p>
-<h4 id="heading_id_7">Variable Naming</h4>
-<div id="ivariables__inames_1"></div>
-<p>Not all variables require names, but most of the variables you will encounter in your programs will have names. Variables in Perl 5 must conform to the standard rules of identifier naming (<a href="chapter_03.html#names">Names</a>(names)). Variables also have leading sigils.</p>
-<div class="author">
-<p>the Variable Naming section seems quite redundant with the Variable Names and Sigils section from names.pod, which gets inserted directly above this section in chapter 3</p>
-</div>
-<h4 id="heading_id_8">Variable Scopes</h4>
+<p>A <em>variable</em> in Perl is a storage location for a value (<a href="chapter_03.html#values">Values</a>(values)). While a trivial program can manipulate values directly, most programs work with variables to simplify the logic of the code. A variable represents values; it's easier to explain the Pythagorean theorem in terms of the variables <code>a</code>, <code>b</code>, and <code>c</code> than by intuiting its principle by producing a long list of valid values. This concept may seem basic, but effective programming requires you to manage the art of balancing the generic and reusable with the specific.</p>
+<h3 id="heading_id_7">Variable Scopes</h3>
 <div id="variable_scopes"></div>
 <div id="ivariables__iscope_0"></div>
 <div id="iscope_0"></div>
-<p>Variables also have visibility, depending on their scope (<a href="chapter_05.html#scope">Scope</a>(scope)). Most of the variables you will encounter have lexical scope <a href="chapter_05.html#lexical_scope">Lexical Scope</a>(lexical_scope)), as the expected visibility of these variables is local.</p>
-<p>Package variables have global visibility throughout the program, but they are only available when prefixed with the name of the containing package. For example:</p>
-<div class="programlisting">
-<pre>
-<code>    package Store::IceCream;
-
-    use vars '$num_flavors';
-    $num_flavors = 42;</code>
-</pre></div>
-<div id="ipragmas__ivars_0"></div>
-<div id="ivars_0"></div>
-<p>The <code>vars</code> pragma declares a global variable without violating the rules of the <code>strict</code> pragma. Within the <code>Store::IceCream</code> package, <code>$num_flavors</code> is available without a namespace prefix. Outside of that package, it is available as <code>$Store::IceCream::num_flavors</code>. If <code>$num_flavors</code> were a lexical variable (declared with <code>my</code>), it would not be available outside of the enclosing scope.</p>
-<div id="iour_0"></div>
-<div id="ikeywords__iour_0"></div>
-<p>You may also declare package variables with the <code>our</code> keyword. Unlike <code>vars</code> variables, these variables have a lexical scope:</p>
-<div class="programlisting">
-<pre>
-<code>    {
-        package Store::Candy;
-
-        our $jellybeans;
-    }
-
-    # $Store::Candy::jellybeans not visible as $jellybeans here</code>
-</pre></div>
-<p>... yet remember that files themselves have their own lexical scopes, where the <code>package</code> declaration on its own does not create a new scope:</p>
+<div id="ibuiltins__ipackage_0"></div>
+<p>Variables are visible to portions of your program depending on their scope (<a href="chapter_05.html#scope">Scope</a>(scope)). Most of the variables you will encounter have lexical scope (<a href="chapter_05.html#lexical_scope">Lexical Scope</a>(lexical_scope)). <em>Files</em> themselves provide their own lexical scopes, such that the <code>package</code> declaration on its own does not create a new scope:</p>
 <div class="programlisting">
 <pre>
 <code>    package Store::Toy;
 
-    our $discount = 0.10;
+    my $discount = 0.10;
 
     package Store::Music;
 
-    # $Store::Toy::discount still visible as $discount
+    # $discount still visible
     say "Our current discount is $discount!";</code>
 </pre></div>
-<div class="sidebar">
-<div id="ilexicals__ipads_0"></div>
-<div id="ilexpads_0"></div>
-<div id="isymbol_tables_0"></div>
-<p>This difference in visibility between package variables and lexical variables is apparent in the different storage mechanisms of these variables within Perl 5 itself. Lexical variables get stored in <i>lexical pads</i> attached to scopes. Every new entry into such a lexical scope requires Perl to create a new pad to contain the values of the variables for that particular entry into the scope. (This is how a function can call itself and not clobber the values of existing variables.)</p>
-<p>Package variables have a storage mechanism called symbol tables. Each package has a single symbol table, and every package variable has an entry in this table. You can inspect and modify this symbol table from Perl; this is how importing works (<a href="chapter_05.html#importing">Importing</a>(importing)).</p>
-</div>
-<h4 id="heading_id_9">Variable Sigils</h4>
+<div id="ibuiltins__ipackage_1"></div>
+<p>As of Perl 5.14, you may provide a block to the <code>package</code> declaration. This syntax <em>does</em> provide a lexical scope:</p>
+<div class="programlisting">
+<pre>
+<code>    package Store::Toy
+    {
+        my $discount = 0.10;
+    }
+
+    package Store::Music
+    {
+        # $discount not available
+    }
+
+    package Store::BoardGame;
+
+    # $discount still not available</code>
+</pre></div>
+<h3 id="heading_id_8">Variable Sigils</h3>
 <div id="sigils"></div>
 <div id="ivariables__isigils_0"></div>
 <div id="isigils_0"></div>
-<p>In Perl 5, the sigil of the variable in a declaration determines the type of the variable, whether scalar, array, or hash. The sigil of the variable used to access the variable determines the type of access to its value. Sigils on variables vary depending on what you do to the variable. For example, you declare an array as <code>@values</code>. You access the first element--a single value--of the array with <code>$values[0]</code>. You access a list of values from the array with <code>@values[ @indices ]</code>. See the arrays (<a href="chapter_03.html#arrays">Arrays</a>(arrays)) and hashes (<a href="chapter_03.html#hashes">Hashes</a>(hashes)) sections for more.</p>
-<h4 id="heading_id_10">Anonymous Variables</h4>
+<p>The sigil of the variable in a declaration determines the type of the variable: scalar, array, or hash. The sigil used when accessing a variable varies depending on what you do to the variable. For example, you declare an array as <code>@values</code>. Access the first element--a single value--of the array with <code>$values[0]</code>. Access a list of values from the array with <code>@values[ @indices ]</code>.</p>
+<h3 id="heading_id_9">Anonymous Variables</h3>
 <div id="ianonymous_variables_0"></div>
 <div id="ivariables__ianonymous_0"></div>
-<p>Perl 5 variables do not <i>need</i> names; Perl can allocate storage space for variables without storing them in lexical pads or symbol tables. These are <i>anonymous</i> variables. The only way to access them is by reference (<a href="chapter_03.html#references">References</a>(references)).</p>
-<h4 id="heading_id_11">Variables, Types, and Coercion</h4>
+<p>Perl variables do not <em>require</em> names. Names exist to help you, the programmer, keep track of an <code>$apple</code>, <code>@barrels</code>, or <code>%cheap_meals</code>. Variables created <em>without</em> literal names in your source code are <em>anonymous</em> variables. The only way to access anonymous variables is by reference (<a href="chapter_03.html#references">References</a>(references)).</p>
+<h3 id="heading_id_10">Variables, Types, and Coercion</h3>
 <div id="ivariables__itypes_0"></div>
-<div id="itypes__icontainers_0"></div>
-<div id="itypes__ivariables_0"></div>
-<div id="icontainer_types_0"></div>
-<p>Perl 5 variables do not enforce types on their values. You may store a string in a variable in one line, append to that variable a number on the next, and reassign a reference to a function (<a href="chapter_03.html#function_references">Function References</a>(function_references)) on the third. The types of the <i>values</i> is flexible (or dynamic), but the type of the <i>variable</i> is static. A scalar variable can only hold scalars. An array variable only contains lists. A hash variable must contain an even-sized list of key/value pairs.</p>
-<p>Assigning to a variable may cause coercion (<a href="chapter_03.html#coercion">Coercion</a>(coercion)). The documented way to determine the number of entries in an array is to evaluate that array in scalar context (<a href="chapter_01.html#context_philosophy">Context</a>(context_philosophy)). Because a scalar variable can only ever contain a scalar, assigning an array to a scalar imposes scalar context on the operation and produces the number of elements in the array:</p>
+<div id="ivariables__icontainer_type_0"></div>
+<div id="ivariables__ivalue_type_0"></div>
+<p>A variable in Perl 5 represents both a value (a dollar cost, available pizza toppings, guitar shops with phone numbers) and the container which stores that value. Perl's type system deals with <em>value types</em> and <em>container types</em>. While a variable's <em>container type</em>--scalar, array, or hash--cannot change, Perl is flexible about a variable's value type. You may store a string in a variable in one line, append to that variable a number on the next, and reassign a reference to a function (<a href="chapter_03.html#function_references">Function References</a>(function_references)) on the third.</p>
+<p>Performing an operation on a variable which imposes a specific value type may cause coercion (<a href="chapter_03.html#coercion">Coercion</a>(coercion)) from the variable's existing value type.</p>
+<p>For example, the documented way to determine the number of entries in an array is to evaluate that array in scalar context (<a href="chapter_01.html#context_philosophy">Context</a>(context_philosophy)). Because a scalar variable can only ever contain a scalar, assigning an array to a scalar imposes scalar context on the operation, and an array evaluated in scalar context returns the number of elements in the array:</p>
 <div class="programlisting">
 <pre>
 <code>    my $count = @items;</code>
 </pre></div>
-<p>The relationship between variable types, sigils, and context is vital to a proper understanding of Perl.</p>
-<h3 id="heading_id_12">Values</h3>
+<p>This relationship between variable types, sigils, and context is essential.</p>
+<h2 id="heading_id_11">Values</h2>
 <div id="values"></div>
-<p>Effective Perl programs depend on the accurate representation and manipulation of values.</p>
 <div id="ivariables_0"></div>
-<div id="ivariables_1"></div>
-<p>Computer programs contain <i>variables</i>: containers which hold <i>values</i>. Values are the actual data the programs manipulate. While it's easy to explain what that data might be--your aunt's name and address, the distance between your office and a golf course on the moon, or the weight of all cookies you've eaten in the past year--the rules regarding the format of that data are often strict. Writing an effective program often means understanding the best (simplest, fastest, most compact, or easiest) way of representing that data.</p>
-<p>While the structure of a program depends heavily on the means by which you model your data with appropriate variables, these variables would be meaningless if they couldn't accurately contain the data itself--the values.</p>
-<h4 id="heading_id_13">Strings</h4>
+<div id="ivalues_0"></div>
+<p>The structure of a program depends heavily on the means by which you model your data with appropriate variables.</p>
+<p>Where variables allow the abstract manipulation of data, the values they hold make programs concrete and useful. The more accurate your values, the better your programs. These values are data--your aunt's name and address, the distance between your office and a golf course on the moon, or the weight of all of the cookies you've eaten in the past year. Within your program, the rules regarding the format of that data are often strict. Effective programs need effective (simple, fast, most compact, most efficient) ways of representing their data.</p>
+<h3 id="heading_id_12">Strings</h3>
 <div id="istrings_0"></div>
-<p>A <i>string</i> is a piece of data with no particular formatting, no particular contents, and no semantic meaning beyond the fact that it's a string. It could be your name. It could be the contents of an image file read from your hard drive. It could be the Perl program itself. A string has no meaning to the program until you give it meaning. A string is a fixed amount of data delineated by quotes of some form, yet Perl strings can grow or shrink as you add to or remove from them.</p>
-<p>Most strings use either single or double quotes:</p>
+<p>A <em>string</em> is a piece of textual or binary data with no particular formatting or contents. It could be your name, the contents of an image file, or your program itself. A string has meaning in the program only when you give it meaning.</p>
+<div id="istrings__idelimiters_0"></div>
+<p>To represent a literal string in your program, surround it with a pair of quoting characters. The most common <em>string delimiters</em> are single and double quotes:</p>
 <div class="programlisting">
 <pre>
-<code>    my $name    = <b>'Donner Odinson, Bringer of Despair'</b>;
-    my $address = <b>"Room 539, Bilskirnir, Valhalla"</b>;</code>
+<code>    my $name    = <strong>'Donner Odinson, Bringer of Despair'</strong>;
+    my $address = <strong>"Room 539, Bilskirnir, Valhalla"</strong>;</code>
 </pre></div>
 <div id="istrings__isingle45quoted_0"></div>
-<p>Characters in a <i>single-quoted string</i> represent themselves literally, with two exceptions. You may embed a single quote inside a single-quoted string by escaping the quote with a leading backlash:</p>
+<p>Characters in a <em>single-quoted string</em> represent themselves literally, with two exceptions. Embed a single quote inside a single-quoted string by escaping the quote with a leading backslash:</p>
 <div class="programlisting">
 <pre>
-<code>    my $reminder = 'Don<b>\'</b>t forget to escape the single quote!';</code>
+<code>    my $reminder = 'Don<strong>\'</strong>t forget to escape '
+                 . 'the single quote!';</code>
 </pre></div>
-<p>If a backslash occurs at the end of the string, escape it with another backslash, lest the Perl parser believe you are trying to escape the trailing single quote:</p>
+<p>You must also escape any backslash at the end of the string to avoid escaping the closing delimiter and producing a syntax error:</p>
 <div class="programlisting">
 <pre>
-<code>    my $exception = 'This string ends with a backslash, not a quote: \\';</code>
+<code>    my $exception = 'This string ends with a '
+                  . 'backslash, not a quote: <strong>\\</strong>';</code>
 </pre></div>
-<div class="author">
-<p>Is it worth mentioning \\ here? Like, what happens when you put \ or \\ or \\\ or \\' or \\\' in a single-quoted string?</p>
-</div>
-<div id="istrings__idouble45quoted_0"></div>
-<p>A <i>double-quoted string</i> has more complex (and often, more useful) behavior. For example, you may encode non-printable characters in the string:</p>
+<p>Any other backslash will be part of the string as it appears, unless two backslashes are adjacent, in which case the first will escape the second:</p>
 <div class="programlisting">
 <pre>
-<code>    my $tab       = "<b>\t</b>";
-    my $newline   = "<b>\n</b>";
-    my $carriage  = "<b>\r</b>";
-    my $formfeed  = "<b>\f</b>";
-    my $backspace = "<b>\b</b>";</code>
+<code>    is('Modern <strong>\</strong> Perl', 'Modern <strong>\\</strong> Perl',
+        'single quotes backslash escaping');</code>
 </pre></div>
-<p>A string declaration may cross logical newlines, such that these two strings are equivalent:</p>
+<div id="istrings__idouble45quoted_0"></div>
+<p>A <em>double-quoted string</em> has several more special characters available. For example, you may encode otherwise invisible whitespace characters in the string:</p>
+<div class="programlisting">
+<pre>
+<code>    my $tab       = "<strong>\t</strong>";
+    my $newline   = "<strong>\n</strong>";
+    my $carriage  = "<strong>\r</strong>";
+    my $formfeed  = "<strong>\f</strong>";
+    my $backspace = "<strong>\b</strong>";</code>
+</pre></div>
+<p>This demonstrates a useful principle: the syntax used to declare a string may vary. You can represent a tab within a string with the <code>\t</code> escape or by typing a tab directly. Within Perl's purview, both strings behave the same way, even though the specific representation of the string may differ in the source code.</p>
+<p>A string declaration may cross logical newlines; these two declarations are equivalent:</p>
 <div class="programlisting">
 <pre>
 <code>    my $escaped = "two\nlines";
     my $literal = "two
     lines";
-    is( $escaped, $literal, '\n and newline are equivalent' );</code>
+    is $escaped, $literal, 'equivalent \n and newline';</code>
 </pre></div>
-<p>You <i>can</i> enter these characters directly in the strings, but it's often difficult to see the visual distinction between one tab character and four (or two or eight) spaces.</p>
+<p>These sequences are often easier to read than their whitespace equivalents.</p>
+<div id="iconcatenation_0"></div>
+<div id="istrings__iconcatenation_0"></div>
+<div id="ioperators__i46_0"></div>
+<p>Perl strings have variable lengths. As you manipulate and modify strings, Perl will change their sizes as appropriate. For example, you can combine multiple strings into a larger string with the <em>concatenation</em> operator <code>.</code>:</p>
+<div class="programlisting">
+<pre>
+<code>    my $kitten = 'Choco' . ' ' . 'Spidermonkey';</code>
+</pre></div>
+<p>This is effectively the same as if you'd initialized the string all at once.</p>
 <div id="iinterpolation_0"></div>
 <div id="istrings__iinterpolation_0"></div>
-<p>You may also <i>interpolate</i> the value of a scalar variable or the values of an array within a double-quoted string directly:</p>
+<p>You may also <em>interpolate</em> the value of a scalar variable or the values of an array within a double-quoted string, such that the <em>current</em> contents of the variable become part of the string as if you'd concatenated them:</p>
 <div class="programlisting">
 <pre>
-<code>    my $factoid = "Did you know that <b>$name</b> lives at <b>$address</b>?";</code>
+<code>    my $factoid = "<strong>$name</strong> lives at <strong>$address</strong>!";
+
+    # equivalent to
+    my $factoid = $name . ' lives at ' . $address . '!';</code>
 </pre></div>
-<p>You may include a literal double-quote inside a double-quoted string by escaping it with a leading backslash:</p>
+<div id="iescaping_0"></div>
+<p>Include a literal double-quote inside a double-quoted string by <em>escaping</em> it (that is, preceding it with a leading backslash):</p>
 <div class="programlisting">
 <pre>
-<code>    my $quote = "\"Ouch,\", he cried.  \"That <i>hurt</i>!\"";</code>
+<code>    my $quote = "\"Ouch,\", he cried.  \"That <em>hurt</em>!\"";</code>
 </pre></div>
-<div id="iquoting_operators_0"></div>
-<div id="iq_0"></div>
+<div id="ioperators__iquoting_0"></div>
+<div id="iq__isingle_quoting_operator_0"></div>
 <div id="ioperators__iq_0"></div>
-<div id="iqq_0"></div>
+<div id="iqq__idouble_quoting_operator_0"></div>
 <div id="ioperators__iqq_0"></div>
-<p>If you find that hideously ugly, you may use an alternate <i>quoting operator</i>. The <code>q</code> operator performs single quoting, while the <code>qq</code> operator performs double quoting. In each case, you may choose your own delimiter for the string. The character immediately following the operator determines the beginning and end of the string. If the character is the opening character of a balanced pair--such as opening and closing braces--the closing character will be the final delimiter. Otherwise, the character itself will be both the starting and ending delimiter.</p>
+<p>When repeated backslashing becomes unwieldy, use an alternate <em>quoting operator</em> by which you can choose an alternate string delimiter. The <code>q</code> operator indicates single quoting, while the <code>qq</code> operator provides double quoting behavior. The character immediately following the operator determines the characters used to delimit the strings. If the character is the opening character of a balanced pair--such as opening and closing braces--the closing character will be the final delimiter. Otherwise, the character itself will be both the starting and ending delimiter.</p>
 <div class="programlisting">
 <pre>
-<code>    my $quote     = <b>qq{</b>"Ouch", he said.  "That <i>hurt</i>!"<b>}</b>;
-    my $reminder  = <b>q^</b>Didn't need to escape the single quote!<b>^</b>;
-    my $complaint = <b>q{</b>It's too early to be awake.<b>}</b>;</code>
+<code>    my $quote     = <strong>qq{</strong>"Ouch", he said.  "That <em>hurt</em>!"<strong>}</strong>;
+    my $reminder  =  <strong>q^</strong>Don't escape the single quote!<strong>^</strong>;
+    my $complaint =  <strong>q{</strong>It's too early to be awake.<strong>}</strong>;</code>
 </pre></div>
 <div id="iheredocs_0"></div>
 <div id="istrings__iheredocs_0"></div>
-<p>Even though you can declare a complex string with a series of embedded escape characters, sometimes it's easier to declare a multi-line string on multiple lines. The <i>heredoc</i> syntax lets you assign one or more lines of a string with a different syntax:</p>
+<p>When declaring a complex string with a series of embedded escapes is tedious, use the <em>heredoc</em> syntax to assign one or more lines of a string:</p>
 <div class="programlisting">
 <pre>
 <code>    my $blurb =&lt;&lt;'END_BLURB';
 
-    He looked up.  "Time is never on our side, my child.  Do you see the irony?
-    All they know is change.  Change is the constant on which they all can
-    agree.  Whereas we, born out of time to remain perfect and perfectly
-    self-aware, can only suffer change if we pursue it.  It is against our
-    nature.  We rebel against that change.  Shall we consider them greater
-    for it?"
+    He looked up. "Time is never on our side, my child.
+    Do you see the irony? All they know is change.
+    Change is the constant on which they all can agree.
+    We instead, born out of time, remain perfect and
+    perfectly self-aware. We only suffer change as we
+    pursue it. It is against our nature. We rebel
+    against that change. Shall we consider them
+    greater for it?"
     END_BLURB</code>
 </pre></div>
-<p>The <code>&lt;&lt;'END_BLURB'</code> syntax has three parts. The double angle-brackets introduce the heredoc. The quotes determine whether the heredoc obeys single-quoted or double-quoted behavior with regard to variable and escape character interpolation. They're optional; the default behavior is double-quoted interpolation. The <code>END_BLURB</code> itself is an arbitrary identifier which the Perl 5 parser uses as the ending delimiter.</p>
-<p>Be careful; regardless of the indentation of the heredoc declaration itself, the ending delimiter <i>must</i> begin in the first column of the program:</p>
+<p>The <code>&lt;&lt;'END_BLURB'</code> syntax has three parts. The double angle-brackets introduce the heredoc. The quotes determine whether the heredoc obeys single- or double-quoted behavior. The default behavior is double-quoted interpolation. <code>END_BLURB</code> is an arbitrary identifier which the Perl 5 parser uses as the ending delimiter.</p>
+<p>Be careful; regardless of the indentation of the heredoc declaration itself, the ending delimiter <em>must</em> start at the beginning of the line:</p>
 <div class="programlisting">
 <pre>
 <code>    sub some_function {
     }</code>
 </pre></div>
 <div class="sidebar">
-<p>If the identifier begins with whitespace, that same whitespace must be present exactly in the ending delimiter. Even if you do indent the identifier, Perl 5 will <i>not</i> remove equivalent whitespace from the start of each line of the heredoc.</p>
+<p>If the identifier begins with whitespace, that same whitespace must be present before the ending delimiter. Yet if you indent the identifier, Perl 5 will <em>not</em> remove equivalent whitespace from the start of each line of the heredoc.</p>
 </div>
-<p>You may use a string in other contexts, such as boolean or numeric; its contents will determine the resulting value (<a href="chapter_03.html#coercion">Coercion</a>(coercion)).</p>
-<h4 id="heading_id_14">Unicode and Strings</h4>
+<p>Using a string in a non-string context will induce coercion (<a href="chapter_03.html#coercion">Coercion</a>(coercion)).</p>
+<h3 id="heading_id_13">Unicode and Strings</h3>
 <div id="unicode"></div>
-<div id="iunicode_0"></div>
-<p><i>Unicode</i> is a system for representing characters in the world's written languages. While most English text uses a character set of only 127 characters (which requires seven bits of storage and fits nicely into eight-bit bytes), it's naïve to believe that you won't someday need an umlaut, for example.</p>
-<p>Perl 5 strings can represent either of two related but different data types:</p>
+<div id="iUnicode_0"></div>
+<p><em>Unicode</em> is a system for representing the characters of the world's written languages. While most English text uses a character set of only 127 characters (which requires seven bits of storage and fits nicely into eight-bit bytes), it's naïve to believe that you won't someday need an umlaut.</p>
+<p>Perl 5 strings can represent either of two separate but related data types:</p>
 <div id="icodepoint_0"></div>
 <ul>
 <li>Sequences of Unicode characters</li>
 <li style="list-style: none; display: inline">
-<p>The Unicode character set contains characters from the scripts of most languages, and various other symbols. Each character has a <i>codepoint</i>, a own unique number which identifies it in the Unicode character set.</p>
+<p>Each character has a <em>codepoint</em>, a unique number which identifies it in the Unicode character set.</p>
 </li>
 <li>Sequences of octets</li>
 <li style="list-style: none; display: inline">
-<p>Binary data is a sequence of 8 bit numbers, each of which can represent a number between 0 and 255.</p>
+<div id="ioctet_0"></div>
+<p>Binary data is a sequence of <em>octets</em>--8 bit numbers, each of which can represent a number between 0 and 255.</p>
 </li>
 </ul>
-<p>Unicode strings and binary strings look very similar. They each have a <code>length()</code>, and you can perform standard string operations on them such as concatenation, splicing, and regular expression processing. Any string which is not purely binary data is textual data, and should be a sequence of Unicode characters.</p>
-<p>However, because of how your operating system represents data on disk or from users or over the network--as sequences of octets--Perl can't know if the data you read is an image file or a text document or anything else. By default, Perl treats all incoming data as sequences of octets. Any additional meaning of the string's contents are your responsibility.</p>
-<h5 id="heading_id_15">Character Encodings</h5>
+<div class="tip">
+<p>Why <em>octet</em> and not <em>byte</em>? Assuming that one character fits in one byte will cause you no end of Unicode grief. Separate the idea of memory storage from character representation.</p>
+</div>
+<p>Unicode strings and binary strings look similar. Each has a <code>length()</code>. Each supports standard string operations such as concatenation, splicing, and regular expression processing. Any string which is not purely binary data is textual data, and should be a sequence of Unicode characters.</p>
+<p>However, because of how your operating system represents data on disk or from users or over the network--as sequences of octets--Perl can't know if the data you read is an image file or a text document or anything else. By default, Perl treats all incoming data as sequences of octets. You must add a specific meaning to that data.</p>
+<h4 id="heading_id_14">Character Encodings</h4>
 <div id="iencoding_0"></div>
 <div id="iUnicode__iencoding_0"></div>
 <div id="iUTF458_0"></div>
 <div id="iASCII_0"></div>
 <div id="iLatin451_0"></div>
-<p>A Unicode string is a sequence of octets which represent a sequence of characters. A <i>Unicode encoding</i> maps octet sequences to characters. Some encodings, such as UTF-8, can encode all of the characters in the Unicode character set. Others, represent a subset of Unicode characters. For example, ASCII encodes plain English text with no accented characters and Latin-1 can represent text in most languages which use the Latin script.</p>
-<p>If you always decode to and from the appropriate encoding at the inputs and outputs of your program, you will avoid many problems.</p>
-<h5 id="heading_id_16">Unicode in Your Filehandles</h5>
+<p>A Unicode string is a sequence of octets which represents a sequence of characters. A <em>Unicode encoding</em> maps octet sequences to characters. Some encodings, such as UTF-8, can encode all of the characters in the Unicode character set. Other encodings represent a subset of Unicode characters. For example, ASCII encodes plain English text with no accented characters, while Latin-1 can represent text in most languages which use the Latin alphabet.</p>
+<p>To avoid most Unicode problems, always decode to and from the appropriate encoding at the inputs and outputs of your program.</p>
+<div class="tip">
+<p>Perl 5.12 supports the Unicode 5.2 standard, while Perl 5.14 supports Unicode 6.0. If you need to care about the differences between Unicode versions, you probably already know to see <span class="url">http://unicode.org/versions/</span>.</p>
+</div>
+<h4 id="heading_id_15">Unicode in Your Filehandles</h4>
 <div id="iopen_0"></div>
+<div id="ibuiltins__iopen_0"></div>
 <div id="iIO_layers_0"></div>
-<p>One source of Unicode input is filehandles. If you tell Perl that a specific filehandle works with encoded text, Perl can convert the data to Unicode strings automatically. To do this, add a IO layer to the mode of the <code>open</code> builtin. An <i>IO layer</i> wraps around input or output and performs some sort of conversion of the data. In this case, the <code>:utf8</code> layer performs decoding of UTF-8 data:</p>
+<p>When you tell Perl that a specific filehandle (<a href="chapter_09.html#files">Files</a>(files)) works with encoded text, Perl will convert the incoming octets to Unicode strings automatically. To do this, add an IO layer to the mode of the <code>open</code> builtin. An <em>IO layer</em> wraps around input or output and converts the data. In this case, the <code>:utf8</code> layer decodes UTF-8 data:</p>
 <div class="programlisting">
 <pre>
 <code>    use autodie;
 </pre></div>
 <div id="ibinmode_0"></div>
 <div id="ibuiltins__ibinmode_0"></div>
-<p>You may also modify an existing filehandle with <code>binmode</code>:</p>
+<p>You may also modify an existing filehandle with <code>binmode</code>, whether for input or output:</p>
 <div class="programlisting">
 <pre>
-<code>    binmode $fh, ':utf8';</code>
-</pre></div>
-<p>This works for input as well as output:</p>
-<div class="programlisting">
-<pre>
-<code>    binmode STDOUT, ':utf8';
+<code>    binmode $fh, ':utf8';
+    my $unicode_string = &lt;$fh&gt;;
+
+    binmode STDOUT, ':utf8';
     say $unicode_string;</code>
 </pre></div>
 <p>Without the <code>utf8</code> mode, printing Unicode strings to a filehandle will result in a warning (<code>Wide character in %s</code>), because files contain octets, not Unicode characters.</p>
-<h5 id="heading_id_17">Unicode in Your Data</h5>
+<h4 id="heading_id_16">Unicode in Your Data</h4>
 <div id="iEncode_0"></div>
-<div id="iEncode__idecode4041_0"></div>
-<div id="iEncode__iencode4041_0"></div>
-<p>The core module <code>Encode</code> provides a function named <code>decode()</code> to convert a scalar containing data in a known format to a Unicode string. For example, if you have UTF-8 data:</p>
+<div id="idecode4041_0"></div>
+<div id="iencode4041_0"></div>
+<p>The core module <code>Encode</code> provides a function named <code>decode()</code> to convert a scalar containing data to a Unicode string. The corresponding <code>encode()</code> function converts from Perl's internal encoding to the desired output encoding:</p>
 <div class="programlisting">
 <pre>
-<code>    my $string = decode('utf8', $data);</code>
+<code>    my $from_utf8 = decode('utf8', $data);
+    my $to_latin1 = encode('iso-8859-1', $string);</code>
 </pre></div>
-<p>The corresponding <code>encode()</code> function converts from Perl's internal encoding to the desired output encoding:</p>
-<div class="programlisting">
-<pre>
-<code>    my $latin1 = encode('iso-8859-1', $string);</code>
-</pre></div>
-<h5 id="heading_id_18">Unicode in Your Programs</h5>
+<h4 id="heading_id_17">Unicode in Your Programs</h4>
 <div id="ipragmas__iutf8_0"></div>
-<div id="iutf8_0"></div>
+<div id="iutf8_pragma_0"></div>
 <div id="iencoding_1"></div>
-<p>You may include Unicode characters in your programs in three ways. The easiest is to use the <code>utf8</code> pragma (<a href="chapter_09.html#pragmas">Pragmas</a>(pragmas)), which tells the Perl parser to interpret the rest of the source code file with the UTF-8 encoding This allows you to use Unicode characters in strings as well in identifiers:</p>
+<p>You may include Unicode characters in your programs in three ways. The easiest is to use the <code>utf8</code> pragma (<a href="chapter_08.html#pragmas">Pragmas</a>(pragmas)), which tells the Perl parser to interpret the rest of the source code file with the UTF-8 encoding. This allows you to use Unicode characters in strings and identifiers:</p>
 <div class="programlisting">
 <pre>
 <code>    use utf8;
 
     sub £_to_¥ { ... }
 
-    my $pounds = £_to_¥('1000£');</code>
+    my $yen = £_to_¥('1000£');</code>
 </pre></div>
-<p>To <i>write</i> this code, your text editor must understand UTF-8 and you must save the file with the appropriate encoding.</p>
-<div id="iescapes__i_x123125_0"></div>
-<div id="i_x123125_0"></div>
-<p>You may also use the Unicode escape sequence to represent character encodings. The syntax <code>\x{}</code> represents a single character; place the hex form of the character's Unicode number within the curly brackets:</p>
+<p>To <em>write</em> this code, your text editor must understand UTF-8 and you must save the file with the appropriate encoding.</p>
+<div id="istrings__i_x123125_0"></div>
+<div id="i_x123125__iescape_sequence_for_character_encodings_0"></div>
+<p>Within double-quoted strings, you may use the Unicode escape sequence to represent character encodings. The syntax <code>\x{}</code> represents a single character; place the hex form of the character's Unicode number within the curly brackets:</p>
 <div class="programlisting">
 <pre>
 <code>    my $escaped_thorn = "\x{00FE}";</code>
 </pre></div>
-<div class="sidebar">
-<p>Note that these escapes interpolate only within double-quoted strings.</p>
-</div>
 <div id="icharnames_pragma_0"></div>
 <div id="ipragmas__icharnames_0"></div>
-<div id="iescapes__i_N123125_0"></div>
-<div id="i_N123125_0"></div>
-<p>Some Unicode characters have names. Though these are more verbose, they can be clearer to read than Unicode numbers. You must use the <code>charnames</code> pragma to enable them. Use the <code>\N{}</code> escape to refer to them:</p>
+<div id="istrings__i_N123125_0"></div>
+<div id="i_N123125__iescape_sequence_for_named_character_encodings_0"></div>
+<p>Some Unicode characters have names, and these names are often clearer to read than Unicode numbers. Use the <code>charnames</code> pragma to enable them and the <code>\N{}</code> escape to refer to them:</p>
 <div class="programlisting">
 <pre>
 <code>    use charnames ':full';
     my $escaped_thorn = "\x{00FE}";
     my $named_thorn   = "\N{LATIN SMALL LETTER THORN}";
 
-    is( $escaped_thorn, $named_thorn, 'Thorn equivalence check' );</code>
+    is $escaped_thorn, $named_thorn,
+        'Thorn equivalence check';</code>
 </pre></div>
 <p>You may use the <code>\x{}</code> and <code>\N{}</code> forms within regular expressions as well as anywhere else you may legitimately use a string or a character.</p>
-<h5 id="heading_id_19">Implicit Conversion</h5>
-<p>Most Unicode problems in Perl arise from the fact that a string could be either a sequence of octets or a sequence of characters. Perl allows you to combine these types through the use of implicit conversions. When these conversions are wrong, they're rarely <i>obviously</i> wrong.</p>
-<p>When Perl concatenates a sequences of octets with a sequence of Unicode characters, it implicitly decodes the octet sequence using the Latin-1 encoding. The resulting string contains Unicode characters. When you print Unicode characters, Perl encodes the string using UTF-8, because Latin-1 cannot represent the entire set of Unicode characters.</p>
+<h4 id="heading_id_18">Implicit Conversion</h4>
+<p>Most Unicode problems in Perl arise from the fact that a string could be either a sequence of octets or a sequence of characters. Perl allows you to combine these types through the use of implicit conversions. When these conversions are wrong, they're rarely <em>obviously</em> wrong.</p>
+<p>When Perl concatenates a sequences of octets with a sequence of Unicode characters, it implicitly decodes the octet sequence using the Latin-1 encoding. The resulting string will contain Unicode characters. When you print Unicode characters, Perl will encode the string using UTF-8, because Latin-1 cannot represent the entire set of Unicode characters--Latin-1 is a subset of UTF-8.</p>
 <p>This asymmetry can lead to Unicode strings encoded as UTF-8 for output and decoded as Latin-1 when input.</p>
-<p>Worse yet, when the text contains only English characters with no accents, the bug hides--because both encodings have the same representation for every such character.</p>
+<p>Worse yet, when the text contains only English characters with no accents, the bug hides--because both encodings have the same representation for every character.</p>
 <div class="programlisting">
 <pre>
 <code>    my $hello    = "Hello, ";
     my $greeting = $hello . $name;</code>
 </pre></div>
-<p>If <code>$name</code> contains an English name such as <code>Alice</code> you will never notice any problem, because the Latin-1 representation is the same as the UTF-8 representation.</p>
-<p>If, on the other hand, <code>$name</code> contains a name like <code>José</code>, <code>$name</code> can contain several possible values:</p>
+<p>If <code>$name</code> contains an English name such as <em>Alice</em> you will never notice any problem, because the Latin-1 representation is the same as the UTF-8 representation. If <code>$name</code> contains a name such as <em>José</em>, <code>$name</code> can contain several possible values:</p>
 <ul>
 <li><code>$name</code> contains four Unicode characters.</li>
 <li><code>$name</code> contains four Latin-1 octets representing four Unicode characters.</li>
 </ul>
 <p>The string literal has several possible scenarios:</p>
 <ul>
-<li>ASCII string literal</li>
+<li>It is an ASCII string literal and contains octets.</li>
 <li style="list-style: none; display: inline">
 <div class="programlisting">
 <pre>
 <code>    my $hello = "Hello, ";</code>
 </pre></div>
-<p>The string literal contains octets.</p>
 </li>
-<li>Latin-1 string literal with no explicit encoding, such as:</li>
+<li>It is a Latin-1 string literal with no explicit encoding and contains octets.</li>
 <li style="list-style: none; display: inline">
 <div class="programlisting">
 <pre>
 </pre></div>
 <p>The string literal contains octets.</p>
 </li>
-<li>Non ASCII string literal with the <code>utf8</code> or <code>encoding</code> pragma:</li>
+<li>It is a non-ASCII string literal with the <code>utf8</code> or <code>encoding</code> pragma in effect and contains Unicode characters.</li>
 <li style="list-style: none; display: inline">
 <div class="programlisting">
 <pre>
 <code>    use utf8;
-    my $hello = "שלום, ";</code>
+    my $hello = "Kuirabá, ";</code>
 </pre></div>
-<p>The string literal contains Unicode characters.</p>
 </li>
 </ul>
 <p>If both <code>$hello</code> and <code>$name</code> are Unicode strings, the concatenation will produce another Unicode string.</p>
-<p>If both strings are octet streams, Perl will concatenate them into a new octet string. If both values are octets of the same encoding--both Latin-1, for example, the concatenation will work correctly. If the octets do not share an encoding, the concatenation append UTF-8 data to Latin-1 data, producing a sequence of octets which makes sense in <i>neither</i> encoding. This could happen if the user entered a name as UTF-8 data and the greeting were a Latin-1 string literal, but the program decoded neither.</p>
-<p>If only one of the values is a Unicode string, Perl will decode the other as Latin-1 data. If this is not the correct encoding, the resulting Unicode characters will be wrong. For example, if the user input were UTF-8 data and the string literal were a Unicode string, the name will be incorrectly decoded into five Unicode characters <code>José</code> instead of <code>José</code> because the UTF-8 data means something else when decoded as Latin-1 data.</p>
-<p>See <code>perldoc perluniintro</code> for far more detail Unicode, encodings, and how to manage incoming and outgoing data in a Unicode world.</p>
-<h4 id="heading_id_20">Numbers</h4>
+<p>If both strings are octet streams, Perl will concatenate them into a new octet string. If both values are octets of the same encoding--both Latin-1, for example, the concatenation will work correctly. If the octets do not share an encoding, for example a concatenation appending UTF-8 data to Latin-1 data, then the resulting sequence of octets makes sense in <em>neither</em> encoding. This could happen if the user entered a name as UTF-8 data and the greeting were a Latin-1 string literal, but the program decoded neither.</p>
+<p>If only one of the values is a Unicode string, Perl will decode the other as Latin-1 data. If this is not the correct encoding, the resulting Unicode characters will be wrong. For example, if the user input were UTF-8 data and the string literal were a Unicode string, the name would be incorrectly decoded into five Unicode characters to form <em>José</em> (<em>sic</em>) instead of <em>José</em> because the UTF-8 data means something else when decoded as Latin-1 data.</p>
+<p>See <code>perldoc perluniintro</code> for a far more detailed explanation of Unicode, encodings, and how to manage incoming and outgoing data in a Unicode world <span class="footnote">(footnote: For <em>far</em> more detail about managing Unicode effectively throughout your programs, see Tom Christiansen's answer to "Why does Modern Perl avoid UTF-8 by default?" <span class="url">http://stackoverflow.com/questions/6162484/why-does-modern-perl-avoid-utf-8-by-default/6163129#6163129</span>)</span>.</p>
+<div class="sidebar">
+<div id="iunicode_strings_0"></div>
+<div id="ipragmas__ifeature_0"></div>
+<p>Perl 5.12 added a feature, <code>unicode_strings</code>, which enables Unicode semantics for all string operations within its scope. Perl 5.14 improved this feature; if you work with Unicode in Perl, it's worth upgrading to at least Perl 5.14.</p>
+</div>
+<h3 id="heading_id_19">Numbers</h3>
 <div id="inumbers_0"></div>
 <div id="iintegers_0"></div>
 <div id="ifloating45point_values_0"></div>
-<p>Perl also supports numbers, both integers and floating-point values. They support scientific notation as well as binary, octal, and hexadecimal representations:</p>
+<p>Perl supports numbers as both integers and floating-point values. You may represent them with scientific notation as well as in binary, octal, and hexadecimal forms:</p>
 <div class="programlisting">
 <pre>
 <code>    my $integer   = 42;
     my $float     = 0.007;
     my $sci_float = 1.02e14;
-    my $binary    = <b>0b</b>101010;
-    my $octal     = <b>0</b>52;
-    my $hex       = <b>0x</b>20;</code>
+    my $binary    = <strong>0b</strong>101010;
+    my $octal     = <strong>0</strong>52;
+    my $hex       = <strong>0x</strong>20;</code>
 </pre></div>
-<p>The emboldened characters are the numeric prefixes for binary, octal, and hex notation respectively. Be aware that the leading zero always indicates octal mode; this can occasionally produce unanticipated confusion.</p>
+<div id="inumbers__irepresentation_prefixes_0"></div>
+<div id="i0b_0"></div>
+<div id="i0_0"></div>
+<div id="i0x_0"></div>
+<p>The emboldened characters are the numeric prefixes for binary, octal, and hex notation respectively. Be aware that a leading zero on an integer <em>always</em> indicates octal mode.</p>
 <div id="inumbers__iunderscore_separator_0"></div>
 <div id="iunderscore_0"></div>
-<div class="sidebar">
-<p>Even though you can represent floating-point values explicitly in Perl 5 with perfect accuracy, Perl 5 stores them internally in a binary format. Comparing floating-point values is sometimes imprecise in specific ways; consult <code>perldoc perlnumber</code> for more details.</p>
+<div class="tip">
+<p>Even though you can write floating-point values explicitly in Perl 5 with perfect accuracy, Perl 5 stores them internally in a binary format. This representation is sometimes imprecise in specific ways; consult <code>perldoc perlnumber</code> for more details.</p>
 </div>
-<p>You may not use commas to separate thousands in numeric literals because the parser will interpret the commas as comma operators. You <i>can</i> use underscores in other places within the number, however. The parser will treat them as invisible characters. Your readers may not. These are equivalent:</p>
+<p>You may not use commas to separate thousands in numeric literals, lest the parser interpret the commas as comma operators. Instead, use underscores within the number. The parser will treat them as invisible characters; your readers may not. These are equivalent:</p>
 <div class="programlisting">
 <pre>
 <code>    my $billion = 1000000000;
     my $billion = 1_000_000_000;
     my $billion = 10_0_00_00_0_0_0;</code>
 </pre></div>
-<p>Consider the most readable alternative, however.</p>
+<p>Consider the most readable alternative.</p>
 <div id="iScalar5858Util_0"></div>
-<div id="ilooks_like_number_0"></div>
-<div id="iScalar5858Util__ilooks_like_number_0"></div>
-<p>Because of coercion (<a href="chapter_03.html#coercion">Coercion</a>(coercion)), Perl programmers rarely have to worry about converting text read from outside the program to numbers. Perl will treat anything which looks like a number as a number in numeric contexts. Even though it almost always does so correctly, occasionally it's useful to know if something really does look like a number. The core module <code>Scalar::Util</code> contains a function named <code>looks_like_number</code> which returns a true value if Perl will consider the given argument numeric.</p>
+<div id="ilooks_like_number4041_0"></div>
+<p>Because of coercion (<a href="chapter_03.html#coercion">Coercion</a>(coercion)), Perl programmers rarely have to worry about converting text read from outside the program to numbers. Perl will treat anything which looks like a number <em>as</em> a number in numeric contexts. In the rare circumstances where you need to know if something looks like a number to Perl, use the <code>looks_like_number</code> function from the core module <code>Scalar::Util</code>. This function returns a true value if Perl will consider the given argument numeric.</p>
 <div id="iRegexp5858Common_0"></div>
-<p>The <code>Regexp::Common</code> module from the CPAN also provides several well-tested regular expressions to identify valid <i>types</i> (whole number, integer, floating-point value) of numeric values.</p>
-<h4 id="heading_id_21">Undef</h4>
+<p>The <code>Regexp::Common</code> module from the CPAN provides several well-tested regular expressions to identify more specific valid <em>types</em> (whole number, integer, floating-point value) of numeric values.</p>
+<h3 id="heading_id_20">Undef</h3>
 <div id="iundef_0"></div>
-<p>Perl 5 has a value which represents an unassigned, undefined, and unknown value: <code>undef</code>. Declared but undefined scalar variables contain <code>undef</code>:</p>
+<p>Perl 5's <code>undef</code> value represents an unassigned, undefined, and unknown value. Declared but undefined scalar variables contain <code>undef</code>:</p>
 <div class="programlisting">
 <pre>
 <code>    my $name = undef;   # unnecessary assignment
     my $rank;           # also contains undef</code>
 </pre></div>
 <div id="iundef__icoercions_0"></div>
-<p><code>undef</code> evaluates to false in boolean context. Interpolating <code>undef</code> into a string--or evaluating it in a string context--produces an <code>uninitialized value</code> warning:</p>
+<p><code>undef</code> evaluates to false in boolean context. Evaluating <code>undef</code> in a string context--such as interpolating it into a string--produces an <code>uninitialized value</code> warning:</p>
 <div class="programlisting">
 <pre>
 <code>    my $undefined;
 <p>... produces:</p>
 <div class="screen">
 <pre>
-<code>    Use of uninitialized value $undefined in concatenation (.) or string...</code>
+<code>    Use of uninitialized value $undefined in
+    concatenation (.) or string...</code>
 </pre></div>
-<h4 id="heading_id_22">The Empty List</h4>
-<div id="iempty_list_0"></div>
-<div id="i4041_0"></div>
-<p>When used on the right-hand side of an assignment, the <code>()</code> construct represents an empty list. When evaluated in scalar context, this evaluates to <code>undef</code>. In list context, it is effectively an empty list.</p>
-<p>When used on the left-hand side of an assignment, the <code>()</code> construct enforces list context. To count the number of elements returned from an expression in list context without using a temporary variable, you use the idiom (<a href="chapter_10.html#idioms">Idioms</a>(idioms)):</p>
+<div id="ibuiltins__idefined_0"></div>
+<p>The <code>defined</code> builtin returns a true value if its operand evaluates to a defined value (anything other than <code>undef</code>):</p>
 <div class="programlisting">
 <pre>
-<code>    my $count = <b>()</b> = get_all_clown_hats();</code>
+<code>    my $status = 'suffering from a cold';
+
+    say <strong>defined</strong> $status;  # 1, which is a true value
+    say <strong>defined</strong> undef;    # empty string; a false value</code>
+</pre></div>
+<h3 id="heading_id_21">The Empty List</h3>
+<div id="iempty_list_0"></div>
+<div id="i4041__iempty_list_0"></div>
+<p>When used on the right-hand side of an assignment, the <code>()</code> construct represents an empty list. In scalar context, this evaluates to <code>undef</code>. In list context, it is an empty list. When used on the left-hand side of an assignment, the <code>()</code> construct imposes list context. To count the number of elements returned from an expression in list context without using a temporary variable, use the idiom (<a href="chapter_10.html#idioms">Idioms</a>(idioms)):</p>
+<div class="programlisting">
+<pre>
+<code>    my $count = <strong>()</strong> = get_all_clown_hats();</code>
 </pre></div>
 <p>Because of the right associativity (<a href="chapter_04.html#associativity">Associativity</a>(associativity)) of the assignment operator, Perl first evaluates the second assignment by calling <code>get_all_clown_hats()</code> in list context. This produces a list.</p>
 <p>Assignment to the empty list throws away all of the values of the list, but that assignment takes place in scalar context, which evaluates to the number of items on the right hand side of the assignment. As a result, <code>$count</code> contains the number of elements in the list returned from <code>get_all_clown_hats()</code>.</p>
-<p>You don't have to understand all of the implications of this code right now, but it does demonstrate how a few of Perl's fundamental design features can combine to produce interesting and useful behavior.</p>
-<h4 id="heading_id_23">Lists</h4>
+<p>If you find that concept confusing right now, fear not. As you understand how Perl's fundamental design features fit together in practice, it will make more sense.</p>
+<h3 id="heading_id_22">Lists</h3>
 <div id="ilists_0"></div>
-<p>A list is a comma-separated group of one or more expressions.</p>
-<p>Lists may occur verbatim in source code as values:</p>
+<p>A list is a comma-separated group of one or more expressions. Lists may occur verbatim in source code as values:</p>
 <div class="programlisting">
 <pre>
 <code>    my @first_fibs = (1, 1, 2, 3, 5, 8, 13, 21);</code>
 <pre>
 <code>    say name(), ' =&gt; ', age();</code>
 </pre></div>
-<p>Note that you do not need parentheses to <i>create</i> lists; where present, the parentheses in these examples group expressions to change the <i>precedence</i> of those expressions (<a href="chapter_04.html#precedence">Precedence</a>(precedence)).</p>
+<p>Parentheses do not <em>create</em> lists. The comma operator creates lists. Where present, the parentheses in these examples group expressions to change their <em>precedence</em> (<a href="chapter_04.html#precedence">Precedence</a>(precedence)).</p>
 <div id="ioperators__irange_0"></div>
 <div id="ioperators__i4646_0"></div>
-<div id="i4646_0"></div>
-<div id="irange_operator_0"></div>
-<p>You may use the range operator to create lists of literals in a compact form:</p>
+<div id="i4646__irange_operator_0"></div>
+<p>Use the range operator to create lists of literals in a compact form:</p>
 <div class="programlisting">
 <pre>
 <code>    my @chars = 'a' .. 'z';
     my @count = 13 .. 27;</code>
 </pre></div>
-<div id="iqw4041_0"></div>
 <div id="ioperators__iqw4041_0"></div>
-<div id="iqw4041_operator_0"></div>
-<p>... and you may use the <code>qw()</code> operator to split a literal string on whitespace to produce a list of strings:</p>
+<div id="iqw4041__iquote_words_operator_0"></div>
+<p>Use the <code>qw()</code> operator to split a literal string on whitespace to produce a list of strings:</p>
 <div class="programlisting">
 <pre>
 <code>    my @stooges = qw( Larry Curly Moe Shemp Joey Kenny );</code>
 </pre></div>
-<div class="sidebar">
-<p>Perl will produce a warning if a <code>qw()</code> contains a comma or the comment character (<code>#</code>), because not only are such characters rarely included in a <code>qw()</code>, their presence usually indicates an oversight.</p>
+<div class="tip">
+<p>Perl will emit a warning if a <code>qw()</code> contains a comma or the comment character (<code>#</code>), because not only are such characters rare in a <code>qw()</code>, their presence usually indicates an oversight.</p>
 </div>
 <p>Lists can (and often do) occur as the results of expressions, but these lists do not appear literally in source code.</p>
-<p>Lists and arrays are not interchangeable in Perl. Lists are values and arrays are containers. You may store a list in an array and you may coerce an array to a list, but they are separate entities. For example, indexing into a list is always occurs in list context. Indexing into an array can occur in scalar context (for a single element) or list context (for a slice):</p>
+<p>Lists and arrays are not interchangeable in Perl. Lists are values. Arrays are containers. You may store a list in an array and you may coerce an array to a list, but they are separate entities. For example, indexing into a list always occurs in list context. Indexing into an array can occur in scalar context (for a single element) or list context (for a slice):</p>
 <div class="programlisting">
 <pre>
-<code>    # you do not need to understand this all
+<code>    # don't worry about the details right now
     sub context
     {
-        my $context = wantarray;
+        my $context = wantarray();
+
         say defined $context
              ? $context
                  ? 'list'