> -----Original Message----- > From: Mumia W. [mailto:[EMAIL PROTECTED] > Sent: Monday, July 10, 2006 11:55 AM > To: Beginners List > Subject: Re: write out filenames of files existing on a filesystem into > afile > > Randal L. Schwartz wrote: > >>>>>> "Rob" == Rob Dixon <[EMAIL PROTECTED]> writes: > > > > Rob> my @new = grep /[^.]/, readdir DIR; > > > > This is still the wrong regex. While it's narrow enough for windows, it > will > > *break* on Unix. No reason not to do the right thing here: > > > > grep { $_ ne "." and $_ ne ".." } readdir DIR; > > > > Rob, I'm surprised you still posted this even after our private email > > exchange. You were *told* in email that this regex is broken. > > > > Therefore, I will warn others to please discount Rob's postings in the > future, > > [...] > > Not quite. Rob's program works for rational input data. I'm on *nux, and > I consider a filename of only periods to be invalid. All that's needed > is a comment in the code that warns people that files consisting of only > periods, including '...', are excluded.
The regex that Rob put forth does not match only files consisting entirely of periods, it matches any file that _starts_ with a period. On a *nix system, a file such as '.bash_profile' would be matched. Randal is correct. > > Your attack on Rob is uncalled-for. I don't believe that Mr. Schwartz attacked the OP; he merely stated that others should check Rob's responses for accuracy. In fact, given that this is a beginner's list, that probably holds true in other instances. And the fact the Randal has written a little on the subject of Perl, inclines me to trust his judgement. ry > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>