in reply to Re: iterating through array and saving matches to new array
in thread iterating through array and saving matches to new array
I am not sure what the intent here is.#!/usr/bin/perl use strict; use warnings; my @b = 1..1000; my @c = 900..1000; my @d = 910..1000; # my @newb = grep {$_>850}(@b&&@c&&@d); ### will not work! my %seen; my @newb = map{ ($_ > 850 and !$seen{$_}++) ? $_: ()} (@b,@c,@d); print "@newb\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: iterating through array and saving matches to new array
by AnomalousMonk (Archbishop) on Apr 19, 2018 at 21:32 UTC | |
by Marshall (Canon) on Apr 19, 2018 at 23:05 UTC | |
by AnomalousMonk (Archbishop) on Apr 20, 2018 at 01:29 UTC | |
by Marshall (Canon) on Apr 20, 2018 at 02:56 UTC | |
by AnomalousMonk (Archbishop) on Apr 21, 2018 at 20:16 UTC | |
|