use Data::Dumper; my %hash; my $key = substr $wort, 0, 1; push @{$hash{$key}}, $wort; print Dumper( \%hash ); print "Alle Worte, die mit 'a' beginnen: ", join " ", @{$hash{a}},"\n";