But is it intuitive?

2004-09-14 Thread Austin Hastings
I was thinking about removing files this morning, and realized that I wish rm supported inclusion/exclusion. In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the source code, etc.) It occurred to me to wonder: can P6's cbut do the same

Re: But is it intuitive?

2004-09-14 Thread Abhijit Mahabal
On Tue, 14 Sep 2004, Austin Hastings wrote: I was thinking about removing files this morning, and realized that I wish rm supported inclusion/exclusion. In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the source code, etc.) It occurred

Re: But is it intuitive?

2004-09-14 Thread Mark J. Reed
On 2004-09-14 at 08:40:55, Austin Hastings wrote: In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the source code, etc.) Well, you can, depending on your shell: in ksh: rm !(Makefile) in bash: ditto, but you have to turn on the extglob

Re: But is it intuitive?

2004-09-14 Thread Luke Palmer
Abhijit Mahabal writes: On Tue, 14 Sep 2004, Austin Hastings wrote: I was thinking about removing files this morning, and realized that I wish rm supported inclusion/exclusion. In particular, I wanted to remove * but not Makefile (since my Makefile uses lwp-download to re-fetch the

Re: But is it intuitive?

2004-09-14 Thread Austin Hastings
Luke Palmer wrote: Judging from this, maybe we ought to have :not. Anyway, it's still possible: $my_rex = rx/fo*/ none(rx/^foo$/); For sure. On a side note, there should be a negating match operator for use inside: rx/\d+/ none(rx/1984/) could get awfully long if you had to handle

Re: But is it intuitive?

2004-09-14 Thread Aaron Sherman
On Tue, 2004-09-14 at 10:11, Abhijit Mahabal wrote: On Tue, 14 Sep 2004, Austin Hastings wrote: That is, can I say: $my_rex = qr/fo*/ but not 'foo'; The word junction came to my mind as I read your mail. $my_rex = qr/fo*/ qr:not/foo/; Of course, the regex itself can do this:

Re: But is it intuitive?

2004-09-14 Thread Juerd
Aaron Sherman skribis 2004-09-14 14:02 (-0400): qr{(fo*) ({$1 ne 'foo'})} What is the second set of parens for? Will the following suffice? rx/ (fo*) { $1 ne 'foo' } / And it is because of the lack of anchors that this won't work as expected? rx/ !before foo fo* / Juerd

Re: But is it intuitive?

2004-09-14 Thread Larry Wall
On Tue, Sep 14, 2004 at 02:02:22PM -0400, Aaron Sherman wrote: : Of course, the regex itself can do this: : : qr{(fo*) ({$1 ne 'foo'})} Er, at the moment bare closures don't care about their return value, so as it currently stands, you'd want something more like: rx/(fo*) {fail if $1

Re: But is it intuitive?

2004-09-14 Thread Larry Wall
On Tue, Sep 14, 2004 at 08:30:45PM +0200, Juerd wrote: : Aaron Sherman skribis 2004-09-14 14:02 (-0400): : qr{(fo*) ({$1 ne 'foo'})} : : What is the second set of parens for? Will the following suffice? : : rx/ (fo*) { $1 ne 'foo' } / Bare closures are used only for their side effects

Re: But is it intuitive?

2004-09-14 Thread Aaron Sherman
On Tue, 2004-09-14 at 14:40, Larry Wall wrote: On Tue, Sep 14, 2004 at 02:02:22PM -0400, Aaron Sherman wrote: : Of course, the regex itself can do this: : : qr{(fo*) ({$1 ne 'foo'})} Er, at the moment bare closures don't care about their return value, so as it currently stands, you'd