sub read_dict{ my $file=$_[0]; my $p=$_[1]; my $direction=$_[2]; my %dict1; open( FILE, "gunzip -c $file |") or die $!; # for each line of input file while () { chomp; local ($l1, $l2, $pr) = split /\|\|\|/; chomp ($l1, $l2,$pr); my @pr = split (/\s/,$pr); chomp $pr[1]; if ($direction) { if ($pr[3]>=$p) { $l1 =~ s/[[:punct:]]//g; $l1 =~ s/\s+/ /g; $l2 =~ s/[[:punct:]]//g; $l2 =~ s/\s+/ /g; $l2 =~ s/^\s+//; $l2 =~ s/\s+$//; $l1 =~ s/^\s+//; $l1 =~ s/\s+$//; chomp ($l1, $l2); if ($l2 && $l1) { push( @{$dict1{lc($l1)}}, lc($l2) );} }} else { if ($pr[1]>=$p) { $l1 =~ s/[[:punct:]]//g; $l1 =~ s/\s+/ /g; $l2 =~ s/[[:punct:]]//g; $l2 =~ s/\s+/ /g; $l2 =~ s/^\s+//; $l2 =~ s/\s+$//; $l1 =~ s/^\s+//; $l1 =~ s/\s+$//; chomp ($l1, $l2); if ($l2 && $l1) { push( @{$dict1{lc($l2)}}, lc($l1) );} }} } # return the hash of arrays!!! return \%dict1; }