Thread in_array() - Funktion bauen (25 answers)
Opened by Gast at 2005-10-13 15:58

pq
 2005-10-13 17:41
#58774 #58774
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
[quote=phaylon,13.10.2005, 14:35]Dann eben Perl6::Junction, das sollte kurzschließen.[/quote]
use List::Util qw(first);
my $enthalten = defined first { $_ eq $search } @array;

List::Util ist mittlerweile standard.

edit: defined statt () =\n\n

<!--EDIT|pq|1129232912-->
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread in_array() - Funktion bauen