in reply to Comparing two arrays
This is probably not appropriate code for a novice and may, in addition, be problematic because it is not the most maintainable, but...
See grep, List::MoreUtils::all and Data::Dump::dd.c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "use List::MoreUtils qw(all); ;; my @ra_1 = (13, 29, 545); my @ra_2 = (5, 7, 9); ;; my @ra_3 = grep { my $e_1 = $_; all { $e_1 % $_ } @ra_2 } @ra_1; dd \@ra_3; " [13, 29]
Update: Changed List::MoreUtils::any to List::MoreUtils::all, Data::Dump to Data::Dump::dd in reference links.
Give a man a fish: <%-(-(-(-<
|
|---|