use strict; my %hash; while () { chomp; split(/ => /); $hash{$_[0]} = $_[1]; } ###### my @arr = (%hash); %hash = splice(@arr,0,10); ###### for (keys %hash) { print "$_ => $hash{$_}\n"; } __DATA__ a => 1 b => 2 c => 3 d => 4 e => 5 f => 6 g => 7