#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    1
    Rep Power
    0

    Search in a list


    Hi everyone,

    I need to write a program to search within a list for a specific number and write the result as output in a text file.


    This is my list that I want to search within it

    Score1----Score2----Start------End
    -4.3 ------24-------- 96----------205
    -2.01-----12---------145---------210
    3---------31---------180---------240
    7---------14---------200---------250
    ...--------...----------...----------...
    ...--------...----------...----------...
    ...--------...----------...----------...


    I need a program to do the following action:
    If a number (96 to 250) fall between start and end values, the program get the score1 and divide it by the score2 and write the result for that number in a text file. But if a number fall in more than one row for example number 185 present in row 1 (96-205) row 2 (145-205) and row 3 (180-240) it produce the average value. For example for number 185 the output value would be ((-4.3/24)+(-2.01/31)+(3/31) )/3

    Could you help me please?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    832
    Rep Power
    496
    Hi,
    you have received an answer in your cross-post on the Perl Guru forum.

IMN logo majestic logo threadwatch logo seochat tools logo