in reply to array of arrays or not
It's one reasonably efficient line using the data as you currently have it:
#! perl -slw use strict; my @a = ( 1, 15, 30, 50, 65 ); my @b = ( 5, 20, 37, 55, 77 ); my( $s1, $s2 ) =( 9, 35 ); my @result = map{ grep $_ >= $s1 && $_ <= $s2, $a[ $_ ] .. $b[ $_ ] } 0 .. $#a; print "@result"; __END__ C:\test>junk12 15 16 17 18 19 20 30 31 32 33 34 35
|
|---|