I've read a directory into an array called @file_list and need to remove any files that start with period from the list (".", "..", ".DS_Store", etc.). This is what I've got so far, but it's only removing "..", still leaving "." and ".DS_Store". Does the period need to be escaped somehow? Help!
foreach (@file_list) { if ($_ =~ /^.+/ { $discard = shift (@file_list); } } FYI, the ultimate goal of the routine this is part of is to randomly select a file corresponding to specified graphic file types within a directory or subdirectory. Since the directories in question will typically only contain graphic files, I'm not trying to go crazy here... unless somebody has an idea of other common issues. Aside from the above problem, I've pretty much got this all working with one other exception: I'm thinking there must be a more efficient way to test for an empty directory than reading the directory into @file_list, removing the files that begin with periods as discussed above, and then testing for an empty array? Thanks sooooooooo much! Jeffrey Paul Burger "There are only two ways to live your life. One is as though nothing is a miracle. The other is as if everything is." --Albert Einstein -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>