How to determin whether I reach the end of file in Perl program? Also , can you tell me where I can get these informations . I scan the "programing perl " by Larry Wall, But it is diffculty to find what I want from such a cyclopaedia.
Thanks
Frank
bright true wrote:
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] <mailto:[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] <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> <http://learn.perl.org/> <http://learn.perl.org/first-response>
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>