in reply to Re: Using foreach to iterate through a hash in an array
in thread Using foreach to iterate through a hash in an array

Oh ok thank you. It works and it seems as if I have skipped a few tutorial pages. I will have to take another look into it and thanks again.
  • Comment on Re^2: Using foreach to iterate through a hash in an array

Replies are listed 'Best First'.
Re^3: Using foreach to iterate through a hash in an array
by AnomalousMonk (Archbishop) on Aug 30, 2017 at 15:08 UTC
    I have tried iterating with foreach and the hash itself

    foreach (keys $hash){
        print $_ . "\n";
    }

    So far so good ...

    Given the code you OPed, it's hard to imagine this would have done anything "good" unless  $hash.was actually a hash reference. If this was the case, please be aware of this from the latest Perl documentation:

    Starting with Perl 5.14, an experimental feature allowed keys to take a scalar expression. This experiment has been deemed unsuccessful, and was removed as of Perl 5.24.
    This experimental ex-feature was also associated with values, each, push, pop and friends.


    Give a man a fish:  <%-{-{-{-<