2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhem.pl: use any in the smartmatch functions (Forum #137776)

git-svn-id: https://svn.fhem.de/fhem/trunk@29381 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2024-11-30 18:54:13 +00:00
parent b762dc20cb
commit 1151dd7255

View File

@ -31,6 +31,7 @@ use Time::HiRes qw(gettimeofday time);
use Scalar::Util qw(looks_like_number);
use POSIX;
use File::Copy qw(copy);
use List::Util qw(any);
use Encode;
##################################################
@ -6492,12 +6493,12 @@ CheckRegexp($$)
# use contains_<type>($scalar, @array) instead of $scalar ~~ @array
sub contains_numeric($@) {
my ($scalar, @array) = @_;
return (grep { $_ == $scalar } @array > 0);
return any { $_ == $scalar } @array;
}
sub contains_string($@) {
my ($scalar, @array) = @_;
return (grep { $_ eq $scalar } @array > 0);
return any { $_ eq $scalar } @array;
}
1;