Re: RFC 262 (v1) Index Attribute

2000-09-28 Thread David L. Nicol
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

Re: RFC 262 (v1) Index Attribute

2000-09-28 Thread John Porter
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

Re: RFC 262 (v1) Index Attribute

2000-09-28 Thread David L. Nicol
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"

Re: RFC 262 (v1) Index Attribute

2000-09-27 Thread David L. Nicol
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

Re: RFC 262 (v1) Index Attribute

2000-09-20 Thread Graham Barr
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

Re: RFC 262 (v1) Index Attribute

2000-09-20 Thread Webmaster
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

Re: RFC 262 (v1) Index Attribute

2000-09-20 Thread Graham Barr
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

Re: RFC 262 (v1) Index Attribute

2000-09-20 Thread Webmaster
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