use strict; use warnings; my %name; while(my $line =) { next unless $line =~ /\S/; #skip blank lines chomp $line; my ($undef, $markerName,undef, undef, $height) = split (/\s+/, $line); $name{$markerName} = $height; } foreach (sort keys %name) { print "$_ => $name{$_}\n"; } =prints a => 55 b => 32 c => 34 =cut __DATA__ 1 a 23 99999 55 4 c 55 8888 34 5 b 45 88888 32