
japhy
Enthusiast
Mar 21, 2001, 7:08 AM
Post #2 of 2
(310 views)
|
Re: Omitting DIR filenames with filespecs
[In reply to]
|
Can't Post
|
|
This is an excellent change to learn how to use regular expressions:
opendir DIR, $path; @files = grep !/^~/, readdir DIR; closedir DIR; That regex says "match a ~ as the first character" and the ! in front of it is the logical NOT operator which flips the value. Thus, if a file DOES have a leading tilde, the regex returns true, but the NOT value of that is false, and therefore, it doesn't pass through. Jeff "japhy" Pinyan -- accomplished hacker, teacher, lecturer, and author
|