Having an array command port.where{port= /.+/}.ports
with result:
[111, 20048, 80, 5556, 5557, 1622, 22, 23, 33080, 5432, 25, 443, 2620, 26365, 2049, 10500, 199, 29460, 7188, 4118, 55755, 35461, 51986, 123, 16515, 161, 646, 659, 13666, 29013, 611, 21460]
I need to select the value match with 2049
and 111
from the array. My code is:
port.where{port= /.+/}.ports.flatten.select {|x| x.to_i == 111 && x.to_i == 2049}
Required result is to select only array matching values [2049,111]
.