note
JaWi
Hi,
<p>
Sorry, I (wrongly) assumed you were an advanced Perl monk. I'll explain my solution step by step:
<p>
<code>
my ( @temp, %authors );
@temp = sort map { my @b=split; $b[2]; } `ls -l /path/to/authors`;
</code>
(<b>NB:</b> note the added path, I forgot that in my original answer!)<br/>
You should read this from right to left: each line of the output of the <b>ls</b> command is <b>split</b> and a <b>map</b> is created of each second element (ie. the user names). The array returned by map is <b>sorted</b> and assigned to @temp.<br/>
The array @temp now contains all authors of the files in your directory, including doubles!
<p>
<code>
foreach ( @temp )
{
$authors{$}=1 if not $authors{$_} and length $_;
}
</code>
This will loop through @temp and make a hash with the author names as key. The value is only stored if it doesn't exists already and has a length of > 0.<br/>
I do this to ensure the hash only contains unique names.
<p>
<code>
print "$_\n" for keys %authors;
</code>
This loops through the keys of the hash %authors and prints them. To get an array of the unique authors of the files in your directory you would do something like <code>my @unique_authors = keys %authors;</code>
<p>
Hope this helps,
<p>
-- JaWi
<p>
"A chicken is an egg's way of producing more eggs."
217209
217233