Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] "Perl For Dummies" Help Requested

Expand Messages
  • Shlomi Fish
    ... The For Dummies books and their ilk have very bad reputations in the technical community. Furthermore, the 1st and 2nd editions of Perl for Dummies
    Message 1 of 4 , Oct 12 11:50 PM
      On Wednesday 13 October 2010 04:23:11 Mike Frank wrote:
      > I have been teaching myself Perl via the "Perl For Dummies" book, and there
      > is one program that will not run as the book indicates it should.
      >

      The "For Dummies" books and their ilk have very bad reputations in the
      technical community. Furthermore, the 1st and 2nd editions of "Perl for
      Dummies" received a very negative review from Mark Jason Dominus:

      http://perl.plover.com/reviews/p54d.html

      May I suggest you head over to http://perl-begin.org/ and pursue one of the
      books or tutorials there instead of reading "Perl for Dummies"?

      > The program uses a flat file database, and I can choose between accessing
      > the file, or quitting. However, neither work.
      >
      > I have Googled for an answer to my problem, but I could not find the
      > solution.
      >
      > I ran the debugger, and I found that when the program reached "$DoSearch
      > =~ tr/A-Z/a-z/c;", the letter that is stored in $DoSearch changes from 'i'
      > or 'q' to 'z'.

      A better way to do it would be:

      [code]
      $DoSearch = lc($DoSearch);
      [/code]

      As for why it doens't work properly - reading from
      http://perldoc.perl.org/perlop.html :

      {{{
      Options:

      c Complement the SEARCHLIST.
      d Delete found but unreplaced characters.
      s Squash duplicate replaced characters.

      If the "/c" modifier is specified, the SEARCHLIST character set is
      complemented.
      }}}

      What the /c flag means that *anything* that is not included in the SEARCHLIST
      is matches. So you turn all the characters that are *not* inside A-Z into
      something else.

      I still think it's good that you know how to use the perl debugger, and that
      you're adhering to some good practices such as "use strict;" and "use
      warnings;". But otherwise, I suggest you follow my advice regarding
      http://perl-begin.org/ .

      Regards,

      Shlomi Fish

      --
      -----------------------------------------------------------------
      Shlomi Fish http://www.shlomifish.org/
      http://www.shlomifish.org/humour/ways_to_do_it.html

      <rindolf> She's a hot chick. But she smokes.
      <go|dfish> She can smoke as long as she's smokin'.

      Please reply to list if it's a mailing list post - http://shlom.in/reply .
    • Mike Frank
      Thank you for your suggestions. I can t understand why this book was marketed by the For Dummies publisher if it doesn t do the job of teaching somebody how
      Message 2 of 4 , Oct 13 5:27 AM
        Thank you for your suggestions.

        I can't understand why this book was marketed by the "For Dummies" publisher
        if it doesn't do the job of teaching somebody how to use Perl.

        I like it because it has some good examples, and the descriptions are
        straight forward and understandable.

        Mike



        -----Original Message-----
        From: perl-beginner@yahoogroups.com [mailto:perl-beginner@yahoogroups.com]
        On Behalf Of Shlomi Fish
        Sent: Wednesday, October 13, 2010 2:51 AM
        To: perl-beginner@yahoogroups.com
        Subject: Re: [PBML] "Perl For Dummies" Help Requested

        On Wednesday 13 October 2010 04:23:11 Mike Frank wrote:
        > I have been teaching myself Perl via the "Perl For Dummies" book, and
        there
        > is one program that will not run as the book indicates it should.
        >

        The "For Dummies" books and their ilk have very bad reputations in the
        technical community. Furthermore, the 1st and 2nd editions of "Perl for
        Dummies" received a very negative review from Mark Jason Dominus:

        http://perl.plover.com/reviews/p54d.html

        May I suggest you head over to http://perl-begin.org/ and pursue one of the
        books or tutorials there instead of reading "Perl for Dummies"?

        > The program uses a flat file database, and I can choose between accessing
        > the file, or quitting. However, neither work.
        >
        > I have Googled for an answer to my problem, but I could not find the
        > solution.
        >
        > I ran the debugger, and I found that when the program reached "$DoSearch
        > =~ tr/A-Z/a-z/c;", the letter that is stored in $DoSearch changes from 'i'
        > or 'q' to 'z'.

        A better way to do it would be:

        [code]
        $DoSearch = lc($DoSearch);
        [/code]

        As for why it doens't work properly - reading from
        http://perldoc.perl.org/perlop.html :

        {{{
        Options:

        c Complement the SEARCHLIST.
        d Delete found but unreplaced characters.
        s Squash duplicate replaced characters.

        If the "/c" modifier is specified, the SEARCHLIST character set
        is
        complemented.
        }}}

        What the /c flag means that *anything* that is not included in the
        SEARCHLIST
        is matches. So you turn all the characters that are *not* inside A-Z into
        something else.

        I still think it's good that you know how to use the perl debugger, and that

        you're adhering to some good practices such as "use strict;" and "use
        warnings;". But otherwise, I suggest you follow my advice regarding
        http://perl-begin.org/ .

        Regards,

        Shlomi Fish

        --
        -----------------------------------------------------------------
        Shlomi Fish http://www.shlomifish.org/
        http://www.shlomifish.org/humour/ways_to_do_it.html

        <rindolf> She's a hot chick. But she smokes.
        <go|dfish> She can smoke as long as she's smokin'.

        Please reply to list if it's a mailing list post - http://shlom.in/reply .


        ------------------------------------

        Unsubscribing info is here:
        http://help.yahoo.com/help/us/groups/groups-32.htmlYahoo! Groups Links
      • merlyn@stonehenge.com
        ... Mike I can t understand why this book was marketed by the For Dummies Mike publisher if it doesn t do the job of teaching somebody how to use Mike
        Message 3 of 4 , Oct 13 10:55 AM
          >>>>> "Mike" == Mike Frank <m-frank@...> writes:

          Mike> I can't understand why this book was marketed by the "For Dummies"
          Mike> publisher if it doesn't do the job of teaching somebody how to use
          Mike> Perl.

          I sat across the dinner table one night from the guy who wrote that
          book. From what I recall, he had just learned Perl himself the weekend
          before he started writing it (I think from "Learning Perl", in fact).
          No kidding. He was looking for something to write after he had just
          completed "Netscape for Dummies", and the editor offered him this book.

          --
          Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
          <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
          Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
          See http://methodsandmessages.posterous.com/ for Smalltalk discussion
        Your message has been successfully submitted and would be delivered to recipients shortly.