in reply to Dereference a hash constant

I don't believe you can make this work. You're defining foo as a hash reference. You'll have to figure out a way to dereference foo without making the parser think you're referring to a variable named %foo and how to avoid creating a new hash reference on every invocation. (I made a lovely infinite loop this way.)

This assumes I even understand what you're trying to do; your example code makes little sense to me. What are you trying to do?

Replies are listed 'Best First'.
Re^2: Dereference a hash constant
by Anonymous Monk on Oct 22, 2009 at 00:31 UTC
    I have a hash which has constant key/values, so I thought of making it as a constant hash. But now I realized it is impossible to iterate through a hash ref. Thanks.
      it is impossible to iterate through a hash ref

      Nuh uh! See 802571.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.