How do I do when handling the data

Discussion in 'Perl Misc' started by CatcherInTheRye, Apr 2, 2004.

  1. Hi, How are you.

    I am a complete perl beginner.
    So, now I don't know how to handle efficiently the raw data to any data
    structure.


    89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    45 ;1;142;|89 ;1;148;|33 ;2;258;| ; ; ;|
    89 ;2;316;|89 ;3;484;|101;1;120;| ; ; ;|
    89 ;3;484;|89 ;1;148;|89 ;2;316;|46 ;1;76 ;|
    46 ;1;76 ;|67 ;2;248;|90 ;3;500;|33 ;2;258;|
    33 ;2;258;|46 ;1;76 ;|45 ;1;142;|90 ;3;500;|
    90 ;3;500;|91 ;3;372;|33 ;2;258;| ; ; ;|
    91 ;3;372;|91 ;1;36 ;|42 ;3;446;|81 ;3;356;|
    91 ;1;36 ;|101;1;120;|92 ;1;50 ;| ; ; ;|
    92 ;1;50 ;|71 ;1;6 ;|72 ;3;370;|74 ;2;214;|
    42 ;3;446;|42 ;1;110;|91 ;3;372;| ; ; ;|
    101;1;120;|89 ;2;316;| ; ; ;| ; ; ;|

    Raw data shown above.
    I hope to check data validation each other data.
    Let me show you the meaning of data.

    "89 ;1;148" of first line is KEY and means CELL;SECTOR;PN
    and has its neighbor list like "89 ;2;316;|89 ;3;484;|45 ;1;142;|"

    Other line has same meaning.

    I hope to code the script to process following conditions.

    1. Don't have same PN in the same line. If there is , print "Same PN in
    the '46 ;1;76 ' "
    89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    * * * *
    2. Second field "89 ;2;316;" should be existed in the line where "89
    ;2;316;" is key.
    if there is not, print "89 ;1;148;" has "89 ;2;316;" but "89 ;2;316"
    don't have "89 ;1;148;".
    89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    +++++++++ *********
    89 ;2;316;|89 ;1;149;|89 ;3;484;|101;1;120;|
    ********* +++++++++

    Thanks in advance,
    CatcherInTheRye, Apr 2, 2004
    #1
    1. Advertising

  2. CatcherInTheRye wrote:
    > I am a complete perl beginner.
    > So, now I don't know how to handle efficiently the raw data to any
    > data structure.


    <snip>

    > I hope to code the script to process following conditions.


    <snip>

    Then you have a reason to learn how to do it, right?

    http://learn.perl.org/

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Apr 2, 2004
    #2
    1. Advertising

  3. CatcherInTheRye

    Anno Siegel Guest

    CatcherInTheRye <> wrote in comp.lang.perl.misc:
    > Hi, How are you.
    >
    > I am a complete perl beginner.
    > So, now I don't know how to handle efficiently the raw data to any data
    > structure.
    >
    >
    > 89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    > 45 ;1;142;|89 ;1;148;|33 ;2;258;| ; ; ;|
    > 89 ;2;316;|89 ;3;484;|101;1;120;| ; ; ;|
    > 89 ;3;484;|89 ;1;148;|89 ;2;316;|46 ;1;76 ;|
    > 46 ;1;76 ;|67 ;2;248;|90 ;3;500;|33 ;2;258;|
    > 33 ;2;258;|46 ;1;76 ;|45 ;1;142;|90 ;3;500;|
    > 90 ;3;500;|91 ;3;372;|33 ;2;258;| ; ; ;|
    > 91 ;3;372;|91 ;1;36 ;|42 ;3;446;|81 ;3;356;|
    > 91 ;1;36 ;|101;1;120;|92 ;1;50 ;| ; ; ;|
    > 92 ;1;50 ;|71 ;1;6 ;|72 ;3;370;|74 ;2;214;|
    > 42 ;3;446;|42 ;1;110;|91 ;3;372;| ; ; ;|
    > 101;1;120;|89 ;2;316;| ; ; ;| ; ; ;|
    >
    > Raw data shown above.
    > I hope to check data validation each other data.
    > Let me show you the meaning of data.
    >
    > "89 ;1;148" of first line is KEY and means CELL;SECTOR;PN
    > and has its neighbor list like "89 ;2;316;|89 ;3;484;|45 ;1;142;|"


    What kind of explanation is that? What's a "CELL", what's a "SECTOR",
    what's a "PN", in what sense can such triplets be "neighbors", how do
    these terms relate to each other, and what does it mean when an entry
    is blank (as happens in the third and fourth column)?

    This opens more questions than it answers.

    > Other line has same meaning.


    Oh, great!

    > I hope to code the script to process following conditions.


    What code? What have you tried so far?

    > 1. Don't have same PN in the same line. If there is , print "Same PN in
    > the '46 ;1;76 ' "
    > 89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    > * * * *
    > 2. Second field "89 ;2;316;" should be existed in the line where "89
    > ;2;316;" is key.
    > if there is not, print "89 ;1;148;" has "89 ;2;316;" but "89 ;2;316"
    > don't have "89 ;1;148;".
    > 89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    > +++++++++ *********
    > 89 ;2;316;|89 ;1;149;|89 ;3;484;|101;1;120;|
    > ********* +++++++++


    We can help you with code you have, but we are not in the business
    of writing programs to specification.

    Anno
    Anno Siegel, Apr 2, 2004
    #3
  4. CatcherInTheRye

    Jim Cochrane Guest

    In article <c4jj3m$p0a$-Berlin.DE>, Anno Siegel wrote:
    > CatcherInTheRye <> wrote in comp.lang.perl.misc:
    >> Hi, How are you.
    >>
    >> I am a complete perl beginner.
    >> So, now I don't know how to handle efficiently the raw data to any data
    >> structure.

    ....
    >> 89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    >> +++++++++ *********
    >> 89 ;2;316;|89 ;1;149;|89 ;3;484;|101;1;120;|
    >> ********* +++++++++

    >
    > We can help you with code you have, but we are not in the business
    > of writing programs to specification.
    >
    > Anno


    I suspect you would be if an appropriate fee were offered :)
    --
    Jim Cochrane;
    [When responding by email, include the term non-spam in the subject line to
    get through my spam filter.]
    Jim Cochrane, Apr 2, 2004
    #4
  5. CatcherInTheRye

    gnari Guest

    "CatcherInTheRye" <> wrote in message
    news:c4jfu3$...
    > Hi, How are you.
    >
    > I am a complete perl beginner.
    > So, now I don't know how to handle efficiently the raw data to any data
    > structure.
    >
    >
    > 89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|

    [snip]
    >
    > "89 ;1;148" of first line is KEY and means CELL;SECTOR;PN
    > and has its neighbor list like "89 ;2;316;|89 ;3;484;|45 ;1;142;|"
    >
    > Other line has same meaning.
    >
    > I hope to code the script to process following conditions.
    >
    > 1. Don't have same PN in the same line. If there is , print "Same PN

    in
    > the '46 ;1;76 ' "
    > 89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    > * * * *


    if would use split() to split the lines into records
    i would use a hash of Arrays to map each neighbour to the keys
    I would use a split again or m// to extract the PNs of each line
    and use a temporary hash to detect duplicates


    > 2. Second field "89 ;2;316;" should be existed in the line where "89
    > ;2;316;" is key.
    > if there is not, print "89 ;1;148;" has "89 ;2;316;" but "89

    ;2;316"
    > don't have "89 ;1;148;".
    > 89 ;1;148;|89 ;2;316;|89 ;3;484;|45 ;1;142;|
    > +++++++++ *********
    > 89 ;2;316;|89 ;1;149;|89 ;3;484;|101;1;120;|
    > ********* +++++++++
    >


    after all lines have been processes, I would loop over the keys
    of the neighbour-hash to make sure all backreferences are there.

    gnari
    gnari, Apr 3, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmljaA==?=

    Handling Events from Data Grid

    =?Utf-8?B?UmljaA==?=, May 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    558
    Teemu Keiski
    May 15, 2004
  2. Abhijit Salvi via .NET 247

    Handling events for Checkboxes in Data Grid

    Abhijit Salvi via .NET 247, Mar 11, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    3,206
    jfleeson
    Mar 11, 2005
  3. Mark Tarver
    Replies:
    22
    Views:
    1,301
    J Kenneth King
    Apr 26, 2009
  4. Peter
    Replies:
    34
    Views:
    1,935
    James Kanze
    Oct 17, 2009
  5. Iñaki Baz Castillo
    Replies:
    1
    Views:
    183
    Iñaki Baz Castillo
    Apr 15, 2008
Loading...

Share This Page