in reply to iterating through array and saving matches to new array

With the replacement of our with my, your method, as a generalized method is fine.

poj's use of grep is preferred when you have a simple criterion, such as your >850, as it will be faster than the generalized method.

Replies are listed 'Best First'.
Re^2: iterating through array and saving matches to new array
by Marshall (Canon) on Apr 16, 2018 at 01:59 UTC
    I am not sure about that!

    That idea of "faster" is true in Python's equivalent, but I'm not at all sure about that in Perl.

    In Perl, the foreach loop should run at about the same speed.