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

Re: [PBML] simple array problem

Expand Messages
  • Prasanna Goupal
    Hi, Q 1) is there any way other than looping through the array? No.There is no way for this. Better way you can put all element into hash and you can check
    Message 1 of 3 , Oct 8, 2005
    • 0 Attachment
      Hi,
      Q 1) is there any way other than looping through the
      array?


      No.There is no way for this. Better way you can put all element into hash and you can check existance of element using

      exists($hash{key}) function of hash.

      Keep key and value both same i.e. 5-5,6-6 etc



      Q2 ) is there any predefined function to check the
      existance of the element in the array..

      NO. There is no such function.

      Regards,
      Prasanna Goupal


      ---------------------------------
      Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

      [Non-text portions of this message have been removed]
    • merlyn@stonehenge.com
      ... jabir now i just want to check if the value of $b i.e 5 jabir exists in the array @a or not This is asked frequently enough that it s (amazingly enough)
      Message 2 of 3 , Oct 8, 2005
      • 0 Attachment
        >>>>> "jabir" == jabir ahmed <jabirahmed@...> writes:

        jabir> now i just want to check if the value of $b i.e 5
        jabir> exists in the array @a or not

        This is asked frequently enough that it's (amazingly enough)
        in the "Frequently Asked Questions", included with your Perl distro.

        I recommend that you skim the "perldoc perlfaq" page at least once a
        month, perhaps starting now, until you know the questions that are
        answered there.

        --
        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.