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

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

Expand Messages
  • Shlomi Fish
    Hi Mike, Forwarding to you until it gets to the list. Regards, Shlomi Fish ... Subject: Re: [PBML] Perl For Dummies Help Requested Date: Wednesday 13 October
    Message 1 of 1 , Oct 13, 2010
    • 0 Attachment
      Hi Mike,

      Forwarding to you until it gets to the list.

      Regards,

      Shlomi Fish

      ---------- Forwarded Message ----------

      Subject: Re: [PBML] "Perl For Dummies" Help Requested
      Date: Wednesday 13 October 2010, 08:50:49
      From: Shlomi Fish <shlomif@...>
      To: perl-beginner@yahoogroups.com

      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 .

      -----------------------------------------
      --
      -----------------------------------------------------------------
      Shlomi Fish http://www.shlomifish.org/
      My Public Domain Photos - http://www.flickr.com/photos/shlomif/

      <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 .
    Your message has been successfully submitted and would be delivered to recipients shortly.