my %Hash; while () { 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;