in reply to Check if element in One Array Exist in Other Array
So, wherever you actually put values into your source array, instead of doing it this way:
just do it this way:@source = ( ... );
Then your check_array sub is just the for loop:%source = map { $_ => undef } ( ... );
sub check_array { my ( $array, $source ) = @_; for ( @$array ) { return if ( ! exists( $$source{$_} )); } return 1; }
|
|---|