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

Re: [PBML] Comparing strings with array of values

Expand Messages
  • James Colannino
    ... Thanks :) James
    Message 1 of 11 , Sep 1, 2005
    • 0 Attachment
      Charles K. Clarkson wrote:

      >James Colannino <> wrote:
      >: Hey everyone. I was wondering if there are any single functions that
      >: take a string and compare it against every string in an array to see
      >: if
      >: a match is found. I could do this manually with a foreach loop, but
      >: I'd prefer to use a single builtin function is one exists. Thanks in
      >: advance.
      >
      > Random lookups are better handled with hashes, not arrays. If you
      >need to maintain order use an ordered hash.
      >
      >if ( $is_valid_color{ $string } ) {
      >
      > Or:
      >
      >if ( defined $colors{ $string } ) {
      >
      >

      Thanks :)

      James
    • merlyn@stonehenge.com
      ... James I should have. Honestly I had forgotten that there was a perl faq I James could read. If it had occured to me I would have done so. I ll James
      Message 2 of 11 , Sep 1, 2005
      • 0 Attachment
        >>>>> "James" == James Colannino <perl-beginner@...> writes:

        James> I should have. Honestly I had forgotten that there was a perl faq I
        James> could read. If it had occured to me I would have done so. I'll
        James> remember to read it from now on.

        How could you have also forgotten that Perl comes with approximately
        ONE THOUSAND pages of documentation and looked there though. At least
        at the table of contents? The table of contents lists no less than
        *nine* lines (ten if you count the TOC) that match something like
        "FAQ".

        >> Even better, read through the
        >> FAQ instead of wasting time surfing the web or filling out your blog
        >> or chatting on IRC.
        >>

        James> I'll keep my comments short and polite and simply state that you're
        James> very rude to have sent such a post publically to this list (if you
        James> wanted to accuse me of not having put any effort into searching for
        James> the answer, especially in such a sarcastic and hostile tone, you
        James> should have done so privately.)

        I'm just going to repeat... if the shoe fits, wear it, otherwise brush
        it off. And the response is not just for you... it's also a warning
        to others to AT LEAST DO YOUR BASIC SEARCH BEFORE ASKING.

        The fact that you're trying to use Perl, but didn't even *remember*
        there was a FAQ, let alone look in it, already says everything about
        you that I need to know with respect to this exchange. Maybe you're a
        different person about other programming languages, or in other
        situations, but I really don't feel I'm out of line to point out
        rather bluntly that you were either lazy or distracted this time
        around, and that WASTES ALL OF OUR TIME, including yours.

        --
        Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
        <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
        Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
        See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
      • Grier Johnson
        On 01 Sep 2005 16:00:58 -0700, merlyn@stonehenge.com ... Is there any chance you can be convinced to lay off the venom and just ignore people you don t think
        Message 3 of 11 , Sep 1, 2005
        • 0 Attachment
          On 01 Sep 2005 16:00:58 -0700, merlyn@...
          <merlyn@...> wrote:

          > The fact that you're trying to use Perl, but didn't even *remember*
          > there was a FAQ, let alone look in it, already says everything about
          > you that I need to know with respect to this exchange. Maybe you're a
          > different person about other programming languages, or in other
          > situations, but I really don't feel I'm out of line to point out
          > rather bluntly that you were either lazy or distracted this time
          > around, and that WASTES ALL OF OUR TIME, including yours.

          Is there any chance you can be convinced to lay off the venom and just
          ignore people you don't think have done their due diligence? Seeing
          your nasty replies is, to me, far worse then someone asking a question
          that's already in the faq.

          Time would be saved on both sides (and you seem awfully concerned with
          this) if you simple didn't reply or spent the bare amount of time
          giving a link to the perl faq.

          --
          Grier
        • acummingsus
          ... (in) an array ] FWIW, if anyone interested: http://perldoc.perl.org/search.html?q=element+in+list
          Message 4 of 11 , Sep 2, 2005
          • 0 Attachment
            --- In perl-beginner@yahoogroups.com, "James Colannino" <perl-
            beginner@c...> wrote:
            > [ snip seeks if exists a match(ing) (element) between a string and
            (in) an array ]

            FWIW, if anyone interested:

            http://perldoc.perl.org/search.html?q=element+in+list

            http://perldoc.perl.org/search.html?q=find+if+element+in+list

            Curiously, that 2nd of the two links drops the faq in question from
            number one on the faq list down to number two on the returned list
            (scrolled down the page to the faq portion).

            http://perldoc.perl.org/search.html?q=find+if+match+element+in+list

            (still at # 2)

            I wonder why the faq's don't come up on top (if/(since?) they contain
            the preferred way to do something?

            Me may at times but may not at other times know what preference order
            in which to take stuff in.

            I suppose the answer to that^^ ^^, at this time anyways, is to know
            the faq's well (since they lead off?) -- do they lead off?

            If so, a bit of emphasis to that effect at above links would improve
            for me.

            But perhaps I've some portion of this wrong.

            Alan.
          • merlyn@stonehenge.com
            ... Grier Is there any chance you can be convinced to lay off the venom and just Grier ignore people you don t think have done their due diligence? I ve
            Message 5 of 11 , Sep 2, 2005
            • 0 Attachment
              >>>>> "Grier" == Grier Johnson <grierj@...> writes:

              Grier> Is there any chance you can be convinced to lay off the venom and just
              Grier> ignore people you don't think have done their due diligence?

              I've tried that. It seems to get worse then. People get even more lazy.

              If I can *scare* someone into "looking into the FAQ first", in the
              long run, my job is done.

              A group support mailing list is only effective when the *real*
              questions are being asked, even when it's a so-called "beginners"
              list. I've been around the net for a long time, and I've seen it
              happen time and time again, that when FAQ-style questions are asked on
              a list, eventually the experts all go away in disgust.

              THERE'S A POINT TO A FAQ. Why do you think the FAQ was invented, and
              carefully collected? So that experts wouldn't have to answer the MOST
              COMMON questions over and over again.

              Not even looking in the FAQ before asking a mailing list, to me, is
              the unacceptable behavior here. "You must be this tall" before
              posting to the net. I'm merely *reacting* to the unacceptable
              behavior. If you think my *reaction* is unacceptable, please look
              back to the root cause.

              Grier> Time would be saved on both sides (and you seem awfully concerned with
              Grier> this) if you simple didn't reply or spent the bare amount of time
              Grier> giving a link to the perl faq.

              For this exchange, yes. For all exchanges overall, no. And I'm going
              long-term on this.

              --
              Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
              <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
              Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
              See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
            • Shawn Corey
              ... Please don t respond to the trolls, it only encourages them to post more of the same. I know it s difficult not to reply but they write these things just
              Message 6 of 11 , Sep 2, 2005
              • 0 Attachment
                Grier Johnson wrote:
                > Is there any chance you can be convinced to lay off the venom and just
                > ignore people you don't think have done their due diligence? Seeing
                > your nasty replies is, to me, far worse then someone asking a question
                > that's already in the faq.
                >
                > Time would be saved on both sides (and you seem awfully concerned with
                > this) if you simple didn't reply or spent the bare amount of time
                > giving a link to the perl faq.
                >
                > --
                > Grier

                Please don't respond to the trolls, it only encourages them to post more
                of the same. I know it's difficult not to reply but they write these
                things just to make you angry. Ignore them long enough and they'll go away.


                --- Shawn
              • merlyn@stonehenge.com
                ... Shawn Please don t respond to the trolls, it only encourages them to Shawn post more of the same. I know it s difficult not to reply but Shawn they
                Message 7 of 11 , Sep 2, 2005
                • 0 Attachment
                  >>>>> "Shawn" == Shawn Corey <shawn.corey@...> writes:

                  Shawn> Please don't respond to the trolls, it only encourages them to
                  Shawn> post more of the same. I know it's difficult not to reply but
                  Shawn> they write these things just to make you angry. Ignore them
                  Shawn> long enough and they'll go away.

                  I presume you're talking about *him* being a troll and not me. It's
                  not my intention to make anyone angry. I do not control anyone's
                  emotions, nor pretend to. In fact, the very phrase "make you angry"
                  implies something that ultimately does not exist.

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