On Sun, 31 Jul 2005 12:05:07 -0700, you wrote:

>wouldn't it be simpler to write something like:   
> 
>my $dirname = "something";
>opendir DH, $dirname or die "opening directory $dirname: $!";
> 
>my @files = readdir DH;
> 
>
>my $random_file;
>
>do {
>    $random_file = "$dirname/$files[ int rand  @files ]";
>    } until (-f $random_file and  whatever_other_conditions($random_file));
> 
>bill walters   

I didn't say mine was the ultimate solution, but my solution has the
advantage of keeping only one filename in memory at a time. If the
directory has a lot of files, that could become an issue.

-- 
Eric Amick
Columbia, MD

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to