use strict; use warnings; # Zeiten und Klassen my %classes = ( 49 => '1. Klasse', 99 => '2. Klasse', 199 => '3. Klasse', 299 => '4. Klasse', 500 => '5. Klasse' ); my $t = 88; # oder von STDIN my $result = ''; foreach my $c( sort {$a <=> $b} keys %classes){ if( $t <= $c ){ $result = $classes{$c}; last; } } print $result ? $result : "Out of Range";