[Petal] Looping through a hash

William McKee william at knowmad.com
Thu Sep 4 11:00:41 BST 2003


Hi all,

Although the docs do not indicate that loops can only be done on arrays,
my testing shows that Petal will die if you try to perform a loop over
a hash (e.g., "Error: Not an ARRAY reference at (eval 10) line 94.").

Is there a way to have Petal loop over the keys of a hash? or must I
convert the hash into an array?

In order to loop through the following list, I'm guessing that I'd want
each key-value pair to be an anonymous array:

»···hash_ref => {
»···»···key1 => 'value1',
»···»···key2 => 'value2',
»···»···key3 => 'value3',
»···}

Any suggestions for easily doing this with a one-liner? What's the
possibility of getting Petal to loop over a hash? or is this infeasible?


Thanks,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com


More information about the Petal mailing list