Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: problem/bug: array definition from command (backticks)



Usually, I don't f'up on my own postings, but hey, here's a somewhat
nicer version of my mail folder printer for future reference:

--- BEGIN printmailfolders-zsh.pl
#!/usr/bin/perl -w
use strict;

my @MAILDIRS = ("$ENV{HOME}/Mail", "$ENV{HOME}/savenews");
my @folders;

foreach my $MAILDIR (@MAILDIRS) {

	opendir DIR, $MAILDIR;
	push @folders, grep {! /^\./ && -r $_ && -f _ && ! -d _ && -s _ && -T _} map {"$MAILDIR/$_"} readdir DIR;
	closedir DIR;

};

@folders = map { m,^.*/([^/]+)$,; qq/"$_?New mail in $1."/} @folders;
print join "\\n", @folders;
--- END printmailfolders-zsh.pl

To potential Perl hackers that read this: Golf? ;-)

HTH,

Jörg



Messages sorted by: Reverse Date, Date, Thread, Author