Re: repeat through hash
Peter Rabbitson <[email protected]> Wed, 19 Apr 2006 21:34:04 -0400
| Newsgroups | gmane.comp.lang.perl.modules.petal |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Apr 19, 2006 at 05:52:00PM -0700, Corey wrote:
>
> Is there any particular technical reason why the 'repeat' syntax can't/won't
> loop through hashes, as though passed to, say, the perl 'keys' or 'values'
> function, or something similar to 'for ( %{ $hash } ) { return $_ }'?
>
> It seems rather limiting to only be able to iterate/loop through arrays or
> arrays of hashes - I'm constantly finding that I have to design my libraries'
> data-structures around Petal; for instance, using arrays of hashes
> rather than plain hashes which are often more natural and appropriate.
>
> Thanks,
>
> Corey
>
What you probably need is the each: function provided by Petal::Utils.
Cheers