Michele Dondi <[EMAIL PROTECTED]> writes:

> Every time I've desired a feature for Perl6 it has turned out that either it
> was already planned to be there or I have been given good resons why it would
> have been better not be there.

And you've done it again. What you ask for is already there. See below.

>
> Now in Perl(5) {forum,newsgroup}s you can often see people doing stuff like
>
>    my @files=grep !/^\.{1,2}/, readdir $dir;
>
> Letting aside the fact that in the 99% of times they're plainly reinventing 
> the
> wheel of glob() a.k.a. File::Glob, there are indeed situations in which one 
> may
> have stuff like
>
> for (@foo) {
>    next if $_ eq 'boo';
>    # do something useful here
> }

  for @foo {
    next if (($_ ne 'boo')..undef)
    # do something useful
  }

> whereas they know in advance that C<if> can succeed at most once (e.g. foo
> could really be C<keys %hash>).
>
> Or another case is this:
>
> while (<>) {
>      if (@buffer < MAX) {
>          push @buffer, $_;
>          next;
>      }
>      # ...
>      shift @buffer;
>      push @buffer, $_;
> }

  while <> {
     if 0..MAX { push @buffer, $_; next }
  end

-- 
Piers Cawley <[EMAIL PROTECTED]>
http://www.bofh.org.uk/

Reply via email to