Permalink
Browse files

Applied edits from Mike Huffman.

  • Loading branch information...
1 parent 4a220d1 commit 79c1dc114844e33ea4ef93ff0543788f93dab82e @chromatic committed Sep 23, 2010
Showing with 37 additions and 6 deletions.
  1. +3 −0 CREDITS
  2. +10 −1 sections/control_flow.pod
  3. +12 −2 sections/hashes.pod
  4. +2 −2 sections/references.pod
  5. +1 −1 sections/scalars.pod
  6. +9 −0 sections/values.pod
View
@@ -170,3 +170,6 @@ E: makamaal.linux@gmail.com
N: Christopher E. Stith
E: cstith@gmail.com
+
+N: Mike Huffman
+E: mhuffman@aracnet.com
View
@@ -282,9 +282,14 @@ subsequent subexpressions. This is most obvious with an example:
=begin programlisting
+ # see preface
+ use Test::More 'no_plan';
+
say "Both true!" if ok(1, 'first subexpression')
&& ok(1, 'second subexpression');
+ done_testing();
+
=end programlisting
=begin sidebar
@@ -540,7 +545,11 @@ You cannot use aliasing to modify I<constant> values, however:
=begin programlisting
- lc for qw( Huey Dewey Louie );
+ for (qw( Huex Dewex Louie ))
+ {
+ $_++;
+ say;
+ }
=end programlisting
View
@@ -247,8 +247,18 @@ contains the given key:
Using C<exists> instead of accessing the hash key directly avoids two problems.
First, it does not check the boolean nature of the hash I<value>; a hash key
may exist with a value even if that value evaluates to a boolean false
-(including C<undef>). Second, with nested data structures, it avoids
-autovivifying (L<autovivification>) the value.
+(including C<undef>):
+
+=begin programlisting
+
+ my %false_key_value = ( 0 => '' );
+ ok( %false_key_value,
+ 'hash containing false key & value should evaluate to a true value' );
+
+=end programlisting
+
+Second, with nested data structures, C<exists> avoids autovivifying
+(L<autovivification>) the value.
X<defined>
X<operators; defined>
View
@@ -80,7 +80,7 @@ dereferencing:
sub reverse_in_place
{
my $name_ref = shift;
- reverse B<$$name>;
+ reverse B<$$name_ref>;
}
my $name = 'Blabby';
@@ -109,7 +109,7 @@ messy:
sub reverse_in_place
{
my $name_ref = shift;
- reverse B<${ $name }>;
+ reverse B<${ $name_ref }>;
}
=end programlisting
View
@@ -58,7 +58,7 @@ You may also perform mathematical operations on strings:
=begin programlisting
- my $call_sign = 'KB7MIU';
+ my $call_sign = 'KBMIU';
my $next_sign = $call_sign++;
# also fine as
View
@@ -749,6 +749,9 @@ context (for a single element) or list context (for a slice):
=begin programlisting
+ # enable say and other features (see preface)
+ use Modern::Perl;
+
# you do not need to understand this all
sub context
{
@@ -766,4 +769,10 @@ context (for a single element) or list context (for a slice):
my @array_slice = @list_slice[context()];
my $array_index = $array_slice[context()];
+ # say imposes list context
+ say context();
+
+ # void context is obvious
+ context()
+
=end programlisting

0 comments on commit 79c1dc1

Please sign in to comment.