#!/usr/bin/perl use strict; use warnings; my %hash; my $l; my @values; while () { chomp; my ($key, $rest) = split /-/; push @{$hash{$key}},$rest; } $l=14; @values= exists $hash{$l} ? @{$hash{$l}}:undef; { print "\n Hash Value of 14 : @{$hash{$l}} \n"; } exit(0); __DATA__ 5-ax 14-vor 65-em 14-auf 14-ab #### Hash Value of 14 : vor auf ab #### if (exists $hash{$l} and @{$hash{$l}}>0) { print "Hash value of $l is $hash{$l}->[0]\n"; #or the short form $hash{$l}[0] } else { print "Nothing found for $l\n"; }