in reply to please reply
"explain this code"
No.
Best regards, Karl
Update:... doesn't this look better...?
#!/usr/bin/perl + @bigrams = (); while (<>) { chomp; push @words, split( /\s+/, $_ ); } for ( $i = 0 ; $i < $#words ; $i++ ) { $bigram = $words[$i] . $words[ $i + 1 ]; $found = -1; for ( $index = 0 ; $index <= $#bigrams ; $index++ ) { { if ( $bigrams[$index] eq $bigram ) { $found = $index; } } } if ( $found > -1 ) { $bigramfrequency[$found]++; } else { push( @bigrams, $bigram ); $bigramfrequency[$#bigrams]++; } } print "Bigrams\n"; for ( $index = 0 ; $index < @bigrams ; $index++ ) { print "$bigrams[$index] : $bigramfrequency[$index]\n"; }
Update2:... and your data...?
Please see the recommendations above how to continue...
«The Crux of the Biscuit is the Apostrophe»
In Section
Seekers of Perl Wisdom