open(GLOSSARY, "glossary.pl") or die $!; my $word = ""; my $trans_hash = (); while () { if ( /\%(\w+)\s*=\s*/ ) { # look for start of hash definition $word = $1; } elsif ( $word ne "" ) { if ( /(\w+)\s*=>\s*([^,])/ ) { # find key => value assignment my ($lang, $trans) = ($1,$2); $trans_hash{$word}{$lang} = $trans; } elsif ( /^\s+\);/ ) { # watch for the end of the definition $word = ""; } } }