Thread Variable Anzahl an Array-Zeilen an Subroutine übergeben (11 answers)
Opened by norvel at 2012-08-03 16:42

Muffi
 2012-08-03 17:14
#160596 #160596
User since
2012-07-18
1465 Artikel
BenutzerIn
[default_avatar]
Ah, kapiert.

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sub naechstes_paket {
    my $handle = shift;
    my @lines = ();
    while (@lines < 10) {
        my $line = <$handle>;
        last unless $line;
        push @lines, $line
    }
    return @lines;
}

while (my @next_lines = naechstes_paket($fil) {
 ... mach was
}
1 + 1 = 10

View full thread Variable Anzahl an Array-Zeilen an Subroutine übergeben