Hey Monks
I have run in to an brick wall with the problem below. I have a subroutine which input the array below and I need to orgaise it into a SQL form. (SQL knowledge is not necessary to annswer this question so please read on!) Any of you familiar with SQL will see I am trying to prevent duplicate results being printed. I have an array (@array2) which contains the columns which would be duplicated so what I want to do is remove duplicate occurances of them from the full statement (stored in @array1) and create a new array (@result) which I can then pass on to the DBI.
INPUT:
------
@array1 = ("tmp0.size", "tmp0.buffersize", "tmp0.value", "tmp1.size",
+"tmp1.buffersize", "tmp1.value");
@array2 = ("size", "buffersize");
OUTPUT:
-------
@result = ("tmp0.size", "tmp0.buffersize", "tmp0.value", "tmp1.value")
+;
Have two results and I need to remove the values in @array2 that are partially matched in @array1. But I need to leave the first occurances. Need it to work for any number of values in both.
I also regret to inform everyone that pending an answer for this question it will be my last post on this site, maybe for ever, because I am finishing up my work experience (this is my last obsticle) and then I'm going back to college and java world.Have to say this site has been such a help. Easily the best resource or community on the net for any problems I have. Thanks
and I hope to return in the future as I have been impressed by Perl.
But I'm not finished yet so any help on the above problem is appreciated. This maybe a fairly easy problem to work out but it's just not coming to me and I have only a day to get over it and finish my program. (I hate deadlines!) So please be patient. Thanks in advance.
j
o
h
n
i
r
l
.
Sum day soon I'Il lern how 2 spelI (nad tYpe)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.