On Sat, Feb 02, 2002 at 01:15:16AM -0500, Michael R. Wolf wrote:
> ======================================================================
>                    | Hash iteration |
> ======================================================================
> 
> 
> %aphorism = (
>       roses   => red,
>       violets => purple,
>       sugar   => "sweet, like maple syrple"
> );
> 
> 
> Fill in the missing pieces to iterate over the hash.  
> 
>  ==> The first blank will set $key to each of the keys of the hash
> (e.g. roses, violets, sugar).
> 
>  ==> The second blank will set $value appropriately.
> 
> 
> foreach ________________________________ {
> 
>     _______________________;
> 
>     print "$key...$value\n";
> 
> }

while (my ($key, $value) = each %aphorism)
{
    print "$key...$value\n";
}

Unless you were looking to order the hash.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to