I'm not sure just what you are looking for, but try something like:

c:\@Work\Perl\monks>perl -e "use warnings; use strict; ;; use List::MoreUtils qw(uniq); use Data::Dumper; ;; my @array1 = ('ux_prim_clk', 'ux_side_clk', 'ux_xtal_frm_refclk', 'pr +im_ibbs'); my @array2 = ('ccu_ux_xtal_frm_refclk_ack', 'ibbs_ux_prim_clkack', 's +br_ux_side_clkack'); ;; my @array1_split_2D = map [ split /_/ ], @array1; my @array2_split_2D = map [ split /_/ ], @array2; ;; print Dumper \@array1_split_2D; print Dumper \@array2_split_2D; ;; for my $ar_array_1_cols (@array1_split_2D) { for my $ar_array_2_cols (@array2_split_2D) { my %array_2_colums = map { $_ => 1 } @$ar_array_2_cols; my @intersection = grep exists $array_2_colums{$_}, uniq @$ar_arr +ay_1_cols; ;; print qq{(@$ar_array_1_cols) elements in (@$ar_array_2_cols): \n} +; if (@intersection) { print qq{ '$_'} for @intersection; } else { print ' - no intersection -'; } print qq{\n}; } print qq{\n}; } " $VAR1 = [ [ 'ux', 'prim', 'clk' ], [ 'ux', 'side', 'clk' ], [ 'ux', 'xtal', 'frm', 'refclk' ], [ 'prim', 'ibbs' ] ]; $VAR1 = [ [ 'ccu', 'ux', 'xtal', 'frm', 'refclk', 'ack' ], [ 'ibbs', 'ux', 'prim', 'clkack' ], [ 'sbr', 'ux', 'side', 'clkack' ] ]; (ux prim clk) elements in (ccu ux xtal frm refclk ack): 'ux' (ux prim clk) elements in (ibbs ux prim clkack): 'ux' 'prim' (ux prim clk) elements in (sbr ux side clkack): 'ux' (ux side clk) elements in (ccu ux xtal frm refclk ack): 'ux' (ux side clk) elements in (ibbs ux prim clkack): 'ux' (ux side clk) elements in (sbr ux side clkack): 'ux' 'side' (ux xtal frm refclk) elements in (ccu ux xtal frm refclk ack): 'ux' 'xtal' 'frm' 'refclk' (ux xtal frm refclk) elements in (ibbs ux prim clkack): 'ux' (ux xtal frm refclk) elements in (sbr ux side clkack): 'ux' (prim ibbs) elements in (ccu ux xtal frm refclk ack): - no intersection - (prim ibbs) elements in (ibbs ux prim clkack): 'prim' 'ibbs' (prim ibbs) elements in (sbr ux side clkack): - no intersection -
See List::MoreUtils or List::Util for  uniq() (which may not be strictly necessary) and Data::Dumper (which is a core module) for  Dumper.

Update 1: See also How do I compute the difference of two arrays? How do I compute the intersection of two arrays? in perlfaq4 (you seem to be looking for an intersection).

Update 2: Changed example code to show extraction of intersection elements to  @intersection array separately from display of the intersection.


Give a man a fish:  <%-{-{-{-<


In reply to Re: remove element from 2D array after comparing it with other 2D array (updated) by AnomalousMonk
in thread remove element from 2D array after comparing it with other 2D array by Newbie95

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.