.

TimestampSeverityPage number of the errorPrintingLocation on PageDescription

.

S131Second code blockThe <code>-E</code> doesn't do what we say it does there. The <code>-E</code> enables new features on the command line, but not in a script. You can change the code example to put the script on the command line:

<pre>
% perl5.10.1 -E 'say q|Hello|'
</pre>

or you can use <code>-M</code> to specify the <code>use 5.010</code> line.

<pre>
% perl5.10.1 -M5.010 'say q|Hello|'
</pre>

That's a bit ugly so you should just skip this section and read the bottom half of the page where we tell you to put <code>use 5.010</code> in the script that needs it.

.

C151First code blockThe extra newline in the <code>print</code> statement isn't really necessary because we never chomped input lines. That could just as well be the following line if you don't want double spacing:

<pre>
print "Found $_";
</pre>

.

5/4/2010 13:39:42Minor technical mistake25last code blockarray 'cats' referred to as 'cat' twice. for loop incremented by 2

.

4/29/2010 8:42:34C331First paragraph under "Assignment in list context"The sentence starts "In list context, the assignment operator". We've used imprecise wording there and we've intertwined two things. It's much better to say "In scalar context, the result of a list assignment is the number of elements on the righthand side." We were trying to say the same thing as the start of the third paragraph under that heading and it didn't come out very clear at all.

.

5/29/2010 11:16:42Typo of typography problem42third paragraph, first linethe hyphenation of 'puzzling' should be puzz-ling, not puz-zling.

.

6/22/2010 2:46:34Minor technical mistake57last code blockforeach (shift) will "iterate" over a one item list, which is the return value from shift.

while ($_ = shift) would work. foreach (@ARGV) would also work, but doesn't prove the point about it being a default argument.

...

By the way, when I first read the code my response was "Oh, that works does it?" rather than "That's wrong!" I had to test it, and email a colleague for confirmation before deciding it was an error!

Rgds,
Ian

.

5/5/2010 14:15:58Formatting error73bottomno newline after "one"; if that is corrected, then "wo" and "hree" should line up vertically.

.

6/8/2010 10:44:39Minor technical mistake78penultimate paragraphAccording to 'perldoc -f sort', the job of the sort subroutine is to return "an integer less than, equal to, or greater than 0" and not "-1, 0 or 1".

.

5/25/2010 11:26:34Minor technical mistake81First code under "Orcish"The Orcish Maneuver on page 81 seems to be wrong.
You printed it using $b on either site of the numeric comparison <=>:

sort { ($m{$b} ||= -M $b) <=> ($m{$b} ||= -M $b) } @list

Shouldn't this be instead a comparison of $a & $b
sort { ($m{$a} ||= -M $a) <=> ($m{$b} ||= -M $b) } @list

.

5/29/2010 12:18:54Typo of typography problem854th code blockin the third example the comment should read
one of the elements in @keys is a
instead of
one the elements in @keys is a

.

6/8/2010 10:54:39Clarification or question88first paragraph under "Multiple branches"The paraphagh ends in "... to break out of the loop:". But the 'given' construct that illustrates what's being said isn't a loop, is it?

.

5/6/2010 21:25:42Typo of typography problem89First paragraph"Once of the other drawbacks" should be "One of the other drawbacks"

.

5/29/2010 12:56:22Clarification or question90first codeThe second code block example has a superfluous join. It should be just:
$file = <$fh>;

.

6/8/2010 12:10:47Clarification or question95second lineThe variable '$all_greater' should be called something like '$not_all_odds' or '$at_least_one_pair'.

.

T961First line under "And more much"List::Utils should be List::Util

.

T961"And more much" headingShould read "And much more"

.

5/25/2010 11:16:14Minor technical mistake103First code blockOn page 103 within the first code block the if statement uses the
wrong variable name:

chomp( $pat = <STDIN>);
my $quoted = quotemeta $pat;
print "matched\n" if /$quotemeta){2}/; -->> s/meta/d/;

.

6/8/2010 13:43:51Minor technical mistake104second code blockThe 'if' condition doesn't match. So, the two print statements won't be executed.

.

5/13/2010 9:48:32Clarification or question106last paraYou mention there are faster ways to parse escaped quotes. Do you explain them later in the book? (I can't find them in the index) Do you mean an XS module, or a module like Text::Balanced?

Thanks!
-- John Wiersba
jrw32982@yahoo.com

.

5/13/2010 10:34:07Minor technical mistake110code in middle of pageShould test $1, $2, $3 for definedness, not with ne "", since that will prevent warnings if -w is in effect.

-- John Wiersba
jrw32982@yahoo.com

.

5/29/2010 14:01:40Typo of typography problem116first lineStaring with Perl 5.10, you can label your captures.
should be
Starting with Perl 5.10, you can label your captures.

.

5/7/2010 0:11:43Minor technical mistake128Second Code blocksubstr( $world, index( $world, Perl ), 4 ) = "Mad Mad Mad Mad";

missing quotes around Perl, should be

substr( $world, index($world, "Perl"), 4) = "Mad Mad Mad Mad";

.

5/29/2010 14:27:48Clarification or question1612nd code block, 2nd lineThe comment
# now makes a copy
should be changed to emphasize the change from the last code block of page 160, that is from array copy to array reference copy.

Maybe like
# now makes a copy of one scalar (the array reference)

.

6/8/2010 17:17:59Clarification or question161second code blockAfter showing the new version of subroutine sum it would be helpful to show how this version should be called in order to pass references to arrays.

.

5/8/2010 19:25:58Minor technical mistake162first sub block$string_ref =~ s/\bPERL\b/Perl/g;

should be

$$string_ref =~ s/\bPERL\b/Perl/g;

.

6/8/2010 17:23:18Clarification or question165first code blockIs the %input hash really necessary? Wouldn't it be more concise and idiomatic to substitute the following line for the first three assignments in routine uses_named_params?

my %param = (foo => 'val1', bar => 'val2', @_);

.

5/31/2010 14:27:12Minor technical mistake172first code blockthe comment in the first code block says
# do stuff with %hash
instead of
# do stuff with $application_root

.

6/10/2010 1:54:38Formatting error185second code block<$fh> should be <$fh1>

by @chunzi

.

5/10/2010 12:53:04Minor technical mistake192Item 56 Item 56 uses File::Spec::Functions function 'catpath'. 'catpath' is only exported by request so the examples require a change to import line:

use File::Spec::Functions qw( catpath catdir );

.

5/29/2010 14:56:45Minor technical mistake197first code blocksubroutine build_lookup has two problems:

1. subroutine build_lookup does not use its parameter $file. Instead it uses the global variable $lookup_file.

2. while uses <$lookup_file_handle> instead of <$lookup_fh>

.

5/18/2010 18:53:01Serious technical mistake264last code blockon page 264, the code block quoted here:

use utf8;
my $phrase = 'Åke on aika körmy';

use Encode;
my $bytes = encode( 'utf8', $phrase );

print
join ':', map { sprintf '%02x', ord($_) }
split //, $bytes;

The output should be:
c3:85:6b:65:20:6f:6e:20:61:69:6b:61:20:6b:c3:b6:72:6d:79

But the book gives the result if comment out the encode line:
c5:6b:65:20:6f:6e:20:61:69:6b:61:20:6b:f6:72:6d:79

And the next sentence: "The first two bytes in the encoded string are \xc5\x6b, which form the capital A with the ring above it." is wrong.

'\xc5' is just the Unicode 'Å'; and the '\xc3\x85' is the UTF-8 'Å'.
Even doesn't reverse those two bytes ('\xc5\x6b'), the '\xc5' will always been converted as the substitution character 0xFFFD.



.

5/27/2010 22:42:50Formatting error290pod at bottomthe Pod example should format with blank lines between the Pod command lines.

For the next page, the output of `pod2mif`, the first line "Translated Pod file" is just a title in previous version in stead of the output content. And the rest output paragraphs should format as a nice one on this page:
http://book.opensourceproject.org.cn/lamp/perl/perl1/opensource/0201419750_ch08lev1sec2.html

If the output format like printed on the book, it makes nonsense to reader how the pod commands works.

By the way, no one knows what pod2mif is, and where to grab the code. Can you give the link?

.

5/28/2010 20:58:20Formatting error294first paragraphsays of the use of that variable: “$^O is stupid and ugly, it wears its pants as a hat“.”

uselese left quote at the end, should be:

says of the use of that variable: “$^O is stupid and ugly, it wears its pants as a hat.”

by @chunzi

.

5/30/2010 9:03:47Formatting error296fourth paragraphThe Test::PodCoverage mod- ule can check that for you.

should be:

The Test::Pod::Coverage mod- ule can check that for you.

The Perl module name is wrong.

by @chunzi

.

6/12/2010 7:59:24Minor technical mistake373third paragraphs/command/shebang/. Should

"If you specify -T on the command line and try to run the program with perl explicitly, you'll get an error:"

be

"If you specify -T on the shebang line and try to run the program with perl explicitly, you'll get an error:"

.

5/14/2010 4:07:52Minor technical mistake379First code block"$sth" should be used instead of "$dbh":
my $array = $sth->execute($id);

.

5/23/2010 10:02:17Minor technical mistake429Third code blockThe code right before "The -n switch" needs a scalar(): alias e2t="perl -le 'print scalar localtime( shift )'"

.

6/8/2010 18:43:16Minor technical mistake431first code blockThe 'print' isn't inserted at the end of the loop, but in a 'continue' block appended to the loop, as you can check via 'perldoc perlrun'. This is semantically different. For instance, if you have a 'next' in the loop block the continue block is still executed.

.

6/8/2010 18:45:09Clarification or question432third code blockIn this version using \K you don't need the capture parenthesis inside the regexp anymore.

.

7/13/2010 7:40:55Typo of typography problem300Second code block- use Inline qw(c);
+ use Inline qw(C);

Small 'c' gives an error "Marker '__C__' does not match Inline 'c' section" (also __c__ as a marker would not work because Inline supports capital 'C').

.

7/14/2010 6:28:00Minor technical mistake379first code blockDBI's execute method returns a status for the execute not an array and since the code is comparing selectall_arrayref instead of:

foreach my $id (@ids) {
my $array = $sth->execute($id);
}

it should really be:
foreach my $id (@ids) {
$sth->execute($id);
$array = $sth->fetchall_arrayref;
}

.

7/20/2010 1:25:00Minor technical mistake612nd and 3rd code examplesshould be 'split /\+/' and NOT 'split /\++/'

.

8/7/2010 18:10:04Minor technical mistake223Fourth code blockThe line of code given:
my @yxz = map { [ $_->[1], $_->[0], $_[2] ] } @xyz;

Should be:
my @yxz = map { [ $_->[1], $_->[0], $_->[2] ] } @xyz;

The original is missing the '->' dereference on the last element within the map, resulting in an undef value being mapped.

.

10/14/2010 3:44:16Typo of typography problem293third code block$] >= 5.0006002

should be

$] >= 5.006002

and same error one row upwards.

.

1/31/2011 23:23:49Minor technical mistake66near end of pageyou show how to assign values to an array: @x = (1,1,2,3,5)
and then show how to to it even simpler: @x = qw(1 1 2 3 5)
but this is not the same:

my @xn = (12,24);
my @xs = qw(12 24);
print $xn[0] & $xn[1]; # -> 8
print $xs[0] & $xs[1]; # '00'

this is exactly the problem you mentioned earlier, eg different behavior when
using strings or numbers. but qw(...) assigns strings, not numbers

.

8/18/2011 18:06:38Serious technical mistake25second paragraphThe statement "If you want to use another variable to hold the line you just read, you have to do the defined check yourself:" is not correct.

See testing code:

sandbox$ cat a.pl
while (my $line = <STDIN>) { print $line }
sandbox$ perl -MO=Deparse a.pl
while (defined(my $line = <STDIN>)) {
print $line;
}
a.pl syntax OK
sandbox$

http://perldoc.perl.org/perlop.html#I/O-Operators also documented this behavior.

.

12/5/2011 16:03:35Minor technical mistake34first code blockmy $count =()= split /:/, $line;

This will always produce 1 in $count, since it is the same as

my $count =()= split(/:/, $line, 1);

(You can see it with Deparse, for example).

I guess it is minor technical issue since it only confuses reader who decides to check the code (example with localtime is OK, though).

.

2/27/2012 6:33:36Minor technical mistake140benchmarked code stringsUse subroutine references instead of code strings, i.e. "sub {" instead of "q{", to define the benchmarked code. Otherwise the foreach loops won't reference the @data array defined at the top of the program. Instead, an empty array will be used. Also, you cannot specify the number of iterations in $ARGV[0] as the "<>" construct interprets the command line arguments as file names.

.

3/12/2012 9:59:26Formatting error391st paragraph@info[0] = <STDIN>;
( $info[0] ) = <STDIN>;
This reads all the lines from standard input, assigns the first one to element
0 of @info, and ignores the rest! Assigning <STDIN> to @info[0]
evaluates <STDIN> in a list context. In a list context, <STDIN> reads all the
lines from standard input and returns them as a list.

At the beginning of paragraph, which is describe: this reads all the lines from standard input....which one? I suppose it would be ( $info[0] ) = <STDIN>;but it is not clear and puzzled me

Great appreciate
Oliver
han.oliver@me.com

.

3/27/2012 7:43:03Typo of typography problem812nd code block of orcish maneuverHi.
You accidentally typed:
....sort { ($m{$b} ||= -M $b ) <==> ......
instead of
....sort { ($m{$a} ||= -M $a ) <==> ......

Regards!

.

5/16/2012 8:19:06Clarification or question25first paragraphYou say that "if you want to use another variable to hold the line you just read, you have to do the defined check yourself." However, when I run

perl -MO=Deparse -e 'while(my $line = <STDIN>) { print $line; }'

It looks like perl is adding a defined check for me.

while (defined(my $line = <STDIN>)) {
print $line;
}

I've tested this on perls 5.8.8 on Red Hat and 5.14.2 on Debian. What gives?

.

6/18/2012 16:53:42Typo of typography problem117paragraphs 3 & 4Separators in the string to be matched are : or ;, but three times in these paragraphs this is given as ,|;

1) "You must use parentheses to set off the ,|; so ...."
2) my @items = split /\s*(,|;)\s*/, $string
3) my @items = split /\s*(?:,|;)\s*/, $string

.

1/9/2013 6:45:21Minor technical mistake258Third and fourth paragraphAlthough not written literally, the text implies that ':utf8' is a shortcut for ':encoding(UTF-8)'. It is not true for input because with ':utf8' it accepts the data without validating that it is valid UTF-8.

.

4/4/2013 5:31:35Typo of typography problem42First code blockIn my second print edition, the line reads:

my $result = 123 . 345 # '123456'

where it should be:

my $result = 123 . 345 # '123345'

.

4/8/2013 21:14:06Minor technical mistake34First code block after first paragraphThe first paragraph mentions "... you want to count the number of elements a global match or a split would produce ...". The example given is

my $count =()= split /:/, $line.

"split", by design, returns the number of elements in scalar context and I suspect the goatse operator is not required to find the count. In fact, I suspect, using the goatse operator is incorrect since in the manner stated, $count (when used with split) will always return 1.

Thank you

.

5/7/2013 18:27:51Minor technical mistake3201st code blockThis is the line:

MyApplication->run unless caller;

Change to:

MyApplication::Icelandic->run unless caller;

.

5/8/2013 19:56:27Typo of typography problem3594th paragraphThis is the sentence:

"Although annoying, that particular warning is less annoying that it used to be."

Change "that" to "than".

.

5/10/2013 16:47:15Typo of typography problem3691st and 2nd code blocksChange "bar" to "Bar".

.

5/10/2013 16:52:17Typo of typography problem3953rd paragraphThis is the sentence:

"If you don't line that bracing style, you can change it to something else that you like better:"

Change "line" to "like".

.

5/12/2013 16:20:42Minor technical mistake4232nd code blockThis is the section of code:

print "$ren\n"; # still prints 'yello ren'
$stimpy = 'later skater';
print "$ren\n"; # STILL prints 'yello ren'

Change to:

print "$ren\n"; # prints 'hello stimpy'
$stimpy = 'later skater';
print "$ren\n"; # still prints 'hello stimpy'

.

5/12/2013 16:35:38Minor technical mistake4261st code blockThis is the line:

my $dow = qw(Sun Mon Tue Wed Thu Fri Sat);

Change to:

my @dow = qw(Sun Mon Tue Wed Thu Fri Sat);

.

5/12/2013 18:10:06Minor technical mistake433all 4 code blocksBecause there are no invocation arguments, the standard input stream is processed. I am guessing that it was intended that the contents of some files be processed instead. Therefore at least 1 file should be specified at the end of each Perl one-liner.

.

.

Add new rows above this cell to keep the named range corr