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" if /$seek/
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 ) {
print
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 $iter (
Webmaster wrote:
What would really be nice here is an Cindex 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 by:
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 Cindex function, similar to the
scalar version, that returns the index of the matching entry in a list. For
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 Cindex function, similar to the
scalar
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 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 block was
NOT
This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
Index Attribute
=head1 VERSION
Maintainer: David Nicol [EMAIL PROTECTED]
Date: 19 Sep 2000
Mailing List: [EMAIL PROTECTED]
Number: 262
Version: 1
Status: Developing
=head1 ABSTRACT
An