hello monks :)
it's waaay too long i haven't been coding (at all), and especially coding in perl, so please forgive me for this dumb dumb dumb question. I haven't found it answered, so either I can't even properly search or it's so dumb nobody ever dared to ask.
my need : I've got two arrays, say :
my @source=(1, 2, 3, 4, 5, 7);
my @target=(0, 1, 3, 4, 6);
and what I want is :
@values_in_target_not_in_source would be (6, 0)
@values_in_source_not_in_target would be (2, 5, 7)
of course I can see plenty of solutions requiring to go throught the lists multiple times
I wish there was some kind of "elegant and yet efficient" (ok : perlish) solution
any idea ?
this is quite close but then I'd need to go throught one of the lists one more time :-/
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.