V
vorticitywolfe
Hello,
I'm been trying to produce a result similar to IDL's where
function...that returns the indices of where a condition is true.
For example:
@array=(2,4,7,9,10,16,20,82);
print where(@array < 20 and @array >= 10);
this should print 4,5 indicating that at index 4 and index 5 this
condition is true.
previous posts always match if something exists in a string, I want to
mathematically check a condition
Do you have any ideas for me?
Thanks for the help!
Jonathan
I'm been trying to produce a result similar to IDL's where
function...that returns the indices of where a condition is true.
For example:
@array=(2,4,7,9,10,16,20,82);
print where(@array < 20 and @array >= 10);
this should print 4,5 indicating that at index 4 and index 5 this
condition is true.
previous posts always match if something exists in a string, I want to
mathematically check a condition
"What are the indices of elements that match?", you'll need something like
@indices = grep $array[$_]=~/something/, 0..$#array;
Do you have any ideas for me?
Thanks for the help!
Jonathan