use strict; use warnings; my %con; while () { chomp($_); next unless /^(.*?)=>(.*)/; $con{$1} = $2; } print "Key: $_, Value: $con{$_}\n" for sort keys %con; __DATA__ article=>art chapter=>chap section=>sec