Eric Amick wrote:
opendir DIRHANDLE, $dirname or die "OOPS! $!";
while (my $filename = readdir(DIRHANDLE)) {
# Assuming subdirectories are ignored. Other criteria
# can be added here.
next if -d "$dirname/$filename";
$random_file = "$dirname/$filename" if rand < 1/(++$file_count);
}
Wouldn't this tend to favor files alphabetically last ? It would take
quite a few iterations to get the first file alphebetically with this.
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
http://www.liquidation.com
http://www.uksurplus.com
http://www.govliquidation.com
http://www.gowholesale.com
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs