Just for the sake of clarifying the origin of the incomprehension, the OP finally stated on a cross post on Perl Gurus (
http://perlguru.com/gforum.cgi?post=79335;sb=post_latest_reply;so=ASC;forum_view=forum_view_collapsed;;page=unread#unread) that he actually wanted to sort the hash alphabetically
by the keys, not by the values, so that this would be the right correction for the sorting statement:
my @keys = sort keys %functions;
Actually, the whole code could be reduced to something as simple as this:
my $info = "out.txt";
open my $out,">", $info or die "could not open $info $!";
print $out "Key: $_ and Value: $functions{$_}\n" for sort keys %functi
+ons;
close $out;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.