[chad@thepurplebuffalo ~/w/x]$ date > asdf
[chad@thepurplebuffalo ~/w/x]$ perl
$now = localtime;
rename 'asdf' , "$now asdf"
[chad@thepurplebuffalo ~/w/x]$ ls -l *asdf*
-rw------- 1 chad users 29 2006-10-28 22:02 Sat\ Oct\ 28\ 22:02:59\ 2
+006\ asdf
-----
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my %hash = (
'a' => [1, 'One'],
'b' => [2, 'Two'],
'c' => [3, 'Three'],
'd' => [4, 'Four'],
'e' => [5, 'Five'],
'f' => [6, 'Six'],
'g' => [12, 'Twelve'],
);
my %key_ht;
foreach my $key (keys %hash) { $key_ht{$hash{$key}[0]} = $key }
print "key_ht:", Dumper(\%key_ht), "\n";
foreach my $key (sort { $a <=> $b } keys %key_ht) {
my $num = $hash{$key_ht{$key}}[0];
my $str = $hash{$key_ht{$key}}[1];
print "Integer is: ", $num, " -- Alpha is: ", $str, "\n";
}
Don't click the following.
http://superfrink.net/tpb.net-xav/
xavier23perlmonks@thepurplebuffalo.net
|