there are two arrays in arrayA and arrayB, I wish to match the list between them regardless of the number(1 2 3 or...) to list down which is not in arrayB compare to arrayA
suppose i wish to get
$VAR1 = 'D,5';
$VAR2 = 'E,6';
but i get the result as...
$VAR1 = 'B,4';
$VAR2 = 'D,5';
$VAR3 = 'E,6';
please guide... thanks
Code:
@arrayA = qw (A,3 B,4 D,5 E,6 );
@arrayB = qw (A,3 B,5 C,5);
my @NotInB = do {
my %inA = map { $_ ,1} (@arrayB,(split',')[0]);
grep (!$inA{$_}, (@arrayA,(split',')[0]));
};
print Dumper @NotInB;
$VAR1 = 'D,5';
$VAR2 = 'E,6';
but i get the result as...
$VAR1 = 'B,4';
$VAR2 = 'D,5';
$VAR3 = 'E,6';
please guide... thanks
Comment