List Info

Thread: Re: Printing values of keys of hash on the basis of sorted hash values




Re: Printing values of keys of hash on the basis of sorted hash values
user name
2007-01-29 05:46:13
>>>>> "Prasanna" == Prasanna Goupal
<perl_developeryahoo.com> writes:

Prasanna> Hi,
Prasanna>   my %hash =
("asdf","1234","ssdsd","4
567","name","01234");
   
Prasanna>   i want output like
Prasanna>   name, asdf,ssdsd
   
Prasanna>   which is on the basis of sorted hash by
values..
   
Prasanna>   How can i do that?
   
Prasanna>   foreach my $val (sort values %hash){
   
Prasanna>      ### I want to print key of $val...
Prasanna>   }

This is a FAQ.  Please consult "perldoc perlfaq"
weekly until you have
memorized all the titles there.  Better yet, read the
various pages when you
get a spare moment... it's very informative.

In particular, you want "How do I sort a hash
(optionally by value instead of
key)?".

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. -
+1 503 777 0095
<merlynstonehenge.com> <URL:http://www.ston
ehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy,
etc. etc.
See PerlTraining.Stonehenge.com for onsite and
open-enrollment Perl training!


Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )