Empresa engajada
I face only one question. If you are given 2 array A={3,1,2,4} B={1,4}. Write a program to compare two arrays and create another array which holds the common values between two array!
Sigiloso
my @A = ( 3,1,2,4,3 ); my @B = ( 1,4,4,5,5 ); my $hash = +{}; my @C; for ( @A ) { $hash->{$_} = 1; } for ( @B ) { $hash->{$_} = 2 if $hash->{$_}; } for ( keys %$hash ) { push @C, $_ if $hash->{$_} > 1; }