Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
neigh.pl
open(my $IN,"./misspell.txt"); open(my $INN,"./correct.txt"); open(my $fh, '>', 'NeighbourhoodReport.txt'); $tokenCnt = 0; $corr = 0; $TokenMatch = 0; my $start_run=time(); print $fh "Neighbourhood Search report\n"; while ($token=<$IN>, $canon=<$INN>) { chomp($token); chomp($canon); $result = `agrep -1 \"^${token}\$" ./dict.txt `; chomp($result); $tokenCnt++; print $fh "${result}\n"; if ($result eq $canon) { $corr++; } } close($IN); my $end_run = time(); my $run_time = $end_run - $start_run; print $fh "Correct: ${corr} in a total of ${tokenCnt}\n"; print $fh "Execution Time : ${run_time}";
run
|
edit
|
history
|
help
0
Basics
Splice
Reference
Array_with_shift_function
Sea
Simple Perl Interview Question
test hello world perl n texs
palindromic dates
1st code
Leonardo Numbers