in reply to Modifying loop structure and placement

Are you serious? This is one of the exercises in JLFord's book? This is exactly the same exercise rootbeer created for our Learning Perl book.

Of course, it's not that unobvious of a question, but this now seems suspicious. Do you have a copy of Learning Perl to compare some of the other exercises for me? I'm curious now.

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

  • Comment on Re: Modifying loop structure and placement

Replies are listed 'Best First'.
Re^2: Modifying loop structure and placement
by irvson (Sexton) on Dec 30, 2009 at 22:24 UTC
    (Oops. Forgot the second part of your question.) I have both books. I'll look for other similarities. Altho your code in this example is so completely different from Ford's that I would not have noticed the similarity right away. I'm just getting started with your book. I'll keep my eyes peeled. (You would probably satisfy your curiosity more quickly by buying a copy of his book -- or getting it from a library. He constructs each chapter so that the script he uses at the end of the chapter sums up what he presented in that chapter.)
Re^2: Modifying loop structure and placement
by irvson (Sexton) on Dec 30, 2009 at 22:13 UTC
    Yes, the Ford script does the same thing, but it's much more involved -- about 175 lines of code. Longer doesn't mean better, of course. I found your script and created the PL file. Much simpler, does the same thing, but uses a regular expression -- which Ford hasn't covered at that point in his book. There sure is a lot to learn here, and comparing the two scripts for "economy" and "verbosity" is just one of those things.