in reply to Filtering array of strings and numbers

Hi nysus

It's not clear from the question, but if you actually need to filter based on numerical equality, in the case where both the $string_or_number and the array element are numbers, then you can use the following:

use Scalar::Util 'looks_like_number'; #... my @filtered = grep { defined && $string_or_number ne $_ && !(looks_like_number($_) && looks_like_number($string_or_number) && $string_or_number == $_) } @strings_or_numbers;

That will, for example, filter out elements that are "5" when $string_or_number is "5.0".