> Right! I have the same idea as you, and I have this :
>
> my @list = ('1234', '4567', '789A', 'BCDE', 'FGHI');
> my $GetLocation = 0;
> my $value = 'BCDE';
>
> for (my $atLoc = 0; $atLoc <= $#list and ! $GetLocation ; $atLoc++)
> { $GetLocation = $atLoc if ($value eq  $list[$atLoc])  }
>
> And I finally got the same ans. =)
> Deal with it by a hash is the only choice....
>

Your script does have some problems. For instance, if the string you're
looking for is in the first (index = 0) position and also in a later
position, the for loop will only find the latter. Also if $GetLocation
stays 0, you don't know whether the string is not present in the array at
all or whether it is just in the beginning position.


Kay




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to