I have a hash that I need to use later and display some values in a
particular order. Perl comes up with its own way of ordering it but I
am wondering if I can instruct perl to have it listed in the way that
I want.
Here is the code
#!/usr/bin/perl -w
use strict;
my $page = {
AUTHOR=>"John Smith",
LANGUAGE=>"English",
TITLE=>"Treasure Island"};
print ref($page). "\n";
print $page->{AUTHOR} . "\n";
print keys %{$page};
print "\n";
print sort (keys %{$page});
Here is the output:
HASH
John Smith
LANGUAGETITLEAUTHOR
AUTHORLANGUAGETITLE
Here is my desired output:
TITLEAUTHORLANGUAGE
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>