* Chris Devers <[EMAIL PROTECTED]> [2002-11-20 15:25]:
>     foreach $i (@array) {
>         # do something with $i
> 
>         # then if appropriate...
>         print $another_array[$i];

But $i is an element of the array, not an integer to be used as an
offset, most likely.

>         # or, perhaps better, perhaps not, use a hash:
>         print $another_hash{$i};
>     }

I think the answer is to use a C-style for loop:

  for (my $i = 0; $i < $#array; $i++) {
      # $i is your "iterator"
      # $array[$i] is the "current" element

      ...

(darren)

-- 
Everything you've learned in school as `obvious' becomes less and less
obvious as you begin to study the universe. For example, there are no
solids in the universe. There's not even a suggestion of a solid.
There are no absolute continuums. There are no surfaces. There are no
straight lines.
    -- R. Buckminster Fuller
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to