sub x{ my( @a, @b ) = @_; print "a:[@a]\nb:[@b]"; }; @x = 1..10; @y = 'a'..'f';; print "x:[@x]\ny:[@y]";; x:[1 2 3 4 5 6 7 8 9 10] y:[a b c d e f] x( @x, @y );; a:[1 2 3 4 5 6 7 8 9 10 a b c d e f] b:[] #### sub MI { my( $string_es, $string_en, $hash_es, $hash_en ) = @_; my $prob_es = ( keys %$hash_es ) / 6939873; my $prob_en = ( keys %$hash_en ) / 6939873; my $common = 0; exists $hash_en->{ $_ } and ++$common for keys %$hash_es; my $prob_es_en= ( $common ) / 6939873; $prob_es_en = ( $prob_es_en + ( $prob_es * $prob_en * 0.1) ) / 1.1; my $mi = $prob_es_en * log( $prob_es_en / ( $prob_es * $prob_en ) ); return $mi; } #### #create hash files from ngram statistics my %hash_en; to_hash( \%hash_en, $file_in_en ); my %hash_es; to_hash( \%hash_es, $file_in_es ); ... sub to_hash { my( $href, $file ) = @_; open(FILE, "<$file"); foreach my $l () { my( $ngram, $line ) = split /\t/, $l; push @{ $href->{ $ngram } }, $line; } close FILE; }