my %daten; while ( ... ) { $array{'key'} = 'value'; } while ( sort ) { print $array{'SORT_KEY'}; }