For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > July 2005 > Convert hash values to list









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Convert hash values to list
Shea Martin

2005-07-26, 5:02 pm

Is there a canned method converting a hash to a list of values. i.e.,

@v = values( %myhash );
@k = keys( %myhash );

BTW - I know how to do it with a loop, just wondering if there was a
builtin...

Thanks,

~S
Shea Martin

2005-07-26, 5:02 pm

Shea Martin wrote:
> Is there a canned method converting a hash to a list of values. i.e.,
>
> @v = values( %myhash );
> @k = keys( %myhash );
>
> BTW - I know how to do it with a loop, just wondering if there was a
> builtin...
>
> Thanks,
>
> ~S


I found the answer. Man looked for about 10 mins on google, with
nothing, usually that means it doesn't exist. I just found the answer on
page 138 of Perl in a Nutshell.

Note to self, RTF! :-)

~S
Paul Lalli

2005-07-27, 9:03 am

Shea Martin wrote:
> Shea Martin wrote:

I'm as to what you're looking for. How does the first
statement above not do what you want?
[color=darkred]
>
> I found the answer.


Could you possibly post the answer you found (along with a
clarification of the question), to better aide those who might have a
similar question in the future?

> Man looked for about 10 mins on google, with
> nothing, usually that means it doesn't exist. I just found the answer on
> page 138 of Perl in a Nutshell.
>
> Note to self, RTF! :-)


The docs that come with Perl (perldoc) and books specifically written
about Perl (the Camel, Llama, Cookbook, and Nutshell) are generally
more likely to get you answers you're looking for than random webpages
returned by Google.

Paul Lalli

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com