Thread Handle in String (6 answers)
Opened by Perl1976 at 2015-05-08 09:39

hlubenow
 2015-05-08 21:23
#180983 #180983
User since
2009-02-22
875 Artikel
BenutzerIn
[default_avatar]
@Perl1976: So z.B. mit readdir():
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use warnings;
use strict;

use Cwd;

my $dh;
opendir($dh, getcwd()) or die;
my @files = readdir($dh);
close($dh);

@files = sort(@files);

my $i;
foreach $i (0 .. $#files) {
    if ($files[$i] eq "." || $files[$i] eq "..") {
        next;
    }
    print $i + 1 . ". " . $files[$i] . "\n";
}

Last edited: 2015-05-08 21:24:41 +0200 (CEST)

View full thread Handle in String