hello , 
 you can do something like the following 
 my $counter = -1;
foreach (@array){
$counter++;
if($_ =~m/$word/){
print "Element ID is $counter";}
}


 On 5/15/05, Frank <[EMAIL PROTECTED]> wrote: 
> 
> Ing. Branislav Gerzo wrote:
> 
> >Frank [F], on Sunday, May 15, 2005 at 19:45 (+0800) typed:
> >
> >F> If i know the element of array, can I get the numeric index of this
> >F> element?
> >
> >Exist a way, but it is better using hash. In arrays you have to
> >iterate over every element.
> >
> >
> ~~~~~~~Pls tell me the way. possibly I need use it. I need get the
> elements from an array after some specific element. Say, I find a
> elements contains the word I want by regular expression ($_ =~ /word1/),
> and then I need get the following element untill another words appears
> ($_ =~ /word2/). I thought the best way for me is to get the numeric
> index of the elements and get the elements i want. Do you have any
> suggestions?
> 
> >
> >
> >
> Thanks,
> 
> Frank
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
>

Reply via email to