Leser: 15
1 2 3 4 5 6 7
opendir my $LOGDIR, qq{./+logs/~$uid}; my @logs = map ( do { $_ if $_ !~ m/^\./xms } , readdir $LOGDIR); closedir $LOGDIR;
my @logs = grep { not m/^\./xms } readdir $LOGDIR;
my @logs = map { m/^\./xms ? () : $_ } readdir $LOGDIR;
1 2 3 4 5 6 7 8 9
opendir my $LOGDIR, qq{./+logs/~$uid}; my @logs = map ( do { if($_ !~ m/^\./xms) { $_ =~ s/\.log//xms; } } , readdir $LOGDIR); closedir $LOGDIR;
my @logs = map { s/\.log$//; $_ } grep { !m/^\./ } readdir $LOGDIR;
1 2 3 4 5 6 7 8 9 10
# ungetestet my @logs = map { unless (m/^\./xms) { $_ =~ s/\.log//xms; $_ } else { () } } readdir $LOGDIR;
1 2 3
opendir my $LOGDIR, qq{./+logs/~$uid} or die "$!"; my @logs = map { !m/^\./ ? s/\.log// : () } readdir($LOGDIR); closedir($LOGDIR);
Guest werCode (perl): (dl )map { !m/^\./ ? s/\.log// : () }
Guest werBesserwissender! ;-)
my @files = readdir $DIRHANDLE;
my @array = map { $action } readdir $DIRHANDLE;
2009-04-15T21:05:28 LinuxerLeider hast Du Deinen Code abgeändert, während ich meine Antwort formulierte....
1 2 3 4 5
opendir ( DIR, $dirname ) || die "Error in opening dir $dirname\n"; while( ($filename = readdir(DIR))){ print("$filename\n"); } closedir(DIR);
1 2 3
opendir(my $LOGDIR, "./+logs/~$uid") or die "$!"; my @logs = map {!/^\./xms ? $_ : "" } readdir($LOGDIR); closedir($LOGDIR);
1 2 3
opendir(my $LOGDIR, "./+logs/~$uid") or die "$!"; my @logs = grep { !/^\./xms } readdir($LOGDIR); closedir($LOGDIR);