John Porter wrote:
>
> David L. Nicol wrote:
> >
> >
> > print "Found It at position ${_:n}!\n" if /$seek/ foreach @items
>
> If we are going to be throwing around attributes like that, why
> don't we switch to using the ubiquitously recognizable dot instead
> of colon?
>
> for my
David L. Nicol wrote:
>
>
> print "Found It at position ${_:n}!\n" if /$seek/ foreach @items
If we are going to be throwing around attributes like that, why
don't we switch to using the ubiquitously recognizable dot instead
of colon?
for my $iter ( @things ) {
pri
Webmaster wrote:
>
> (I have attached a prototype of what I had in mind)
>
> From: "David L. Nicol" <[EMAIL PROTECTED]>
> > Yes, that is exactly what is being suggested, but the "indexof" function
> > is implicit in the attribute. Your code becomes
> >
> > print "Found It at position ${_:n}!\n"
Webmaster wrote:
> What would really be nice here is an C function, similar to the
> scalar version, that returns the index of the matching entry in a list. For
> instance:
>
> my $n=0;
> foreach (@items){
> print "Found It at position $n!\n" if /$seek/;
> $n++;
> }
> Could be replaced
On Wed, Sep 20, 2000 at 09:03:39AM -0400, Webmaster wrote:
> Graham Barr Wrote:
> >Well if there ever is a way to shortcut grep this could be genera;ized
> >to
> >
> > my $index = grep { break if $_ eq $seek; 1 } @items;
>
> Wouldn't this also assume that grep return the number of times the bloc
Graham Barr Wrote:
>Well if there ever is a way to shortcut grep this could be genera;ized
>to
>
> my $index = grep { break if $_ eq $seek; 1 } @items;
Wouldn't this also assume that grep return the number of times the block was
NOT true, rather than it's current implementation of the number of
On Wed, Sep 20, 2000 at 08:05:20AM -0400, Webmaster wrote:
> David Nicol Wrote in RFC 262:
> >foreach $item (@items){
> >#print "$item was at location ",$item:n,"\n";
> >print "$item was at location ${item:n}\n";
> >};
>
> What would really be nice here is an C function, similar to the
> scalar v
David Nicol Wrote in RFC 262:
>foreach $item (@items){
>#print "$item was at location ",$item:n,"\n";
>print "$item was at location ${item:n}\n";
>};
What would really be nice here is an C function, similar to the
scalar version, that returns the index of the matching entry in a list. For
instanc