I have two arrays
A1=0 1 2 3 4 5 6 7
A2=6 7
I have to remove elements 6 and 7 from A1 which are present in A2.
Basically whatever elements are present in A2 should be removed from A1.
How do i do it, one way was splice but i am getting different outputs not what I expect ?
Note : A1 is for me is an array of reference
foreach my $A1 (@cpu_lists)
@A2 = @{$A1}[-n..-1]; #A2 is derived from A1
@{$A1} = splice @{$A1},6,-1;#A1 should be spliced to remove elements o
+f A2
where n = number of elements which we want in A2.
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.