On 7/10/06, Mumia W. <[EMAIL PROTECTED]> wrote:
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. Your attack on Rob is uncalled-for.
I'm not sure how this thread took this turn over a simple invalid regex, but Randall's "attack" isn't at all uncalled-for. This list is here to help people learn how to do things, learn why what they're doing doesn't work, and learn why the suggestions they're given do work. Rob's regex does none of that. It doesn't solve the your problem (although it appears to). It doesn't work as advertised. And persisting in pushing an obvious kuldge doesn't help anyone learn anything except how to take shortcuts that will bite them in the @ss later. Trying to force an unsound answer on a newbie is completely unacceptable, especially when a correct answer--from JWK, no less--is on offer. That's like giving someone who has never fired a gun before a rifle and saying "here you go, it's all loaded, and I even took the safety off to make it easy for you." Being wrong is fine. Defending your wrongness repeatedly and continuing to force it on newbies and clutter up the group with it in the face of reasoned explanations from two of the world's foremost PH's is not only silly, it looks incredibly troll-like. The goal of this list is to give advice that not only seems to work on limited test cases, but is logically sound and just generally good programming. Rob, it seems, doesn't agree with that approach. And that's what RS took him, justly, to task over. HTH, -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!
