steph_bow has asked for the wisdom of the Perl Monks concerning the following question:
my %Hash; while (<INFILE>) { my $Line = $_; my @Elements = split(";", $Line); my $hour = $Elements[5]; print STDOUT "L'heure vaut $hour\n"; if ($Elements[5] =~ /^(\d\d):(\d\d):(\d\d)/ ){ my $time = 3600*$1+60*$2+$3; $Hash{"$time"} = $Line; print STDOUT "the value of the Hash couple is $Hash{$time}"; } } close INFILE; print SDOUT "%Hash"; my @KEYS = keys(%Hash); sort(@KEYS); print STDOUT "The set of the keys is @KEYS"; my $hour_triee; foreach $hour_triee(@KEYS){ print OUTFILE "$Hash{$hour_triee}"; } close OUTFILE;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: modify the oder a list with the help of a hash table
by ikegami (Patriarch) on Jul 26, 2007 at 15:55 UTC | |
|
Re: modify the oder a list with the help of a hash table
by FunkyMonk (Bishop) on Jul 26, 2007 at 16:55 UTC | |
|
Re: modify the oder a list with the help of a hash table
by snopal (Pilgrim) on Jul 26, 2007 at 16:00 UTC | |
|
Re: modify the order a list with the help of a hash table
by shmf (Novice) on Jul 27, 2007 at 14:32 UTC |