develooper Front page | perl.perl6.users | Postings from August 2019

Checking If a certain object is present in Array

Thread Next
From:
Mikkel
Date:
August 15, 2019 14:29
Subject:
Checking If a certain object is present in Array
Message ID:
CANUJ3NogYF0_1dLh7GVi=Hm9=fDOkC0bVk+ROW_aiY5=HOLcUQ@mail.gmail.com
Hello.

Suppose I have an array (or should I say a positional?):
my @objects = [1, True, "string", 5, Str.new];
Containing different kind of objects. It could be Ints, Strs and Bools.
Is there a nice way of determining if for example a Bool is present in the
array, returning True or False whether the given object is present or not?

Best Regards
Mikkel Birkedam

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About