perl -E "@a1=qw(1 2 3); @a2=qw(a b c d e); say for (@a1 & @a2)" 1 perl -E "@a1=qw(1 2 3); @a2=qw(a b c d e); say for (@a1 , @a2)" 1 2 3 a b c d e #### open(FILE, "## my @array; ... #push 1 push @array, $_ for grep{.. #push 2 push @array, $_ for grep{.. #### # pseudocode my %report; foreach my $line( $fh_one ){ if... matching.. extract the part interesting $report{ $interesting_part }[0] = 1; # first file populates the element 0 foreach my $line( $fh_two ){ if... matching.. extract the part interesting $report{ $interesting_part }[1] = 1; # first file populates the element 1 # result like %report = ( interesting1 = [ undef, 1 ], # is present only in the second file interesting2 = [ 1, undef ], # is present only in the first file interesting3 = [ 1, 1 ], # is present in both files );