The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

keithg (1) [Avatar] Offline
#1
I noticed that some of the example programs in section 1.6.2 print out extra newlines after each line, thereby putting a blank line after each of the printed input lines.

Reading on to the table of invocation options in the next chapter, I see that the "-l" option chomps newlines from input, but only when used with the -n or -p option. So, I think the initial programs without -n or -p invocation options are reading in input lines with the newline intact and then appending an additional newline on the end of each line when printing it out.

By the way, I love this book so far. It's the most interesting language tutorial I've seen in a long time, and I have a fair collection from a brief stint at a book distribution center. Thanks for making it interesting.
tmaher (37) [Avatar] Offline
#2
Re: Some example cat-like programs in section 1.6.2 functionally different
Keith,


Your analysis is correct; the output lines from the programs on p. 13 that have the -l option but not -n or -p have additional newlines added, giving a double-spacing effect. (I'm referring to the large program and the one-liner that follows it.) All the programs were tested extensively during the writing of the book, so I'm certain that the offending -l options weren't always there 8-{ . However, mistakes sometimes creep in during proofreading or copy editing. Thanks for bringing this to my attention! I'll update the errata list to specify removal of the unnecessary -l options.