Thread Nur bestimmte Werte aus einer Liste ausgeben (3 answers)
Opened by Wild.Card at 2018-01-22 19:41

hlubenow
 2018-01-22 20:05
#187941 #187941
User since
2009-02-22
875 Artikel
BenutzerIn
[default_avatar]
Das Pendant zu grep() wäre wohl:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

use warnings;
use strict;

my @array = (1 .. 15); 
my @result = ();
my $i;

foreach $i (@array) { 
    if ($i > 5 && $i < 12) {
        push(@result, $i);
    }
} 
foreach $i (@result) {
    print "$i\n";
}

View full thread Nur bestimmte Werte aus einer Liste ausgeben