in reply to Re^2: Tips on how to perform this regex query
in thread Tips on how to perform this regex query
Correct for that and compare:c:\test\anonymonks.pl Global symbol "$lenBig" requires explicit package name at C:\test\1070 +240.pl line 9. Execution of C:\test\1070240.pl aborted due to compilation errors.
my $bigstring="MNRIYSLRYSA..."; my $smallstring="GTMARNDGQGKAA..."; my $lenBig = length $bigstring; my $lenSmall = length $smallstring; for my $o ( 0 .. ( $lenBig - $lenSmall + 1 ) ) { my $masked = substr( $bigstring, $o, $lenSmall ) ^ $smallstring; my $matched = $masked =~ tr[\0][]; if( ( $matched / $lenSmall ) > 0.095 ) { $masked =~ tr[\1-\255][ ]; $masked =~ tr[\0][*]; printf "%.2f%% match at offset %u\n", $matched / $lenSmall * 1 +00, $o; print substr $bigstring, $o, $lenSmall; print $smallstring; print $masked; } } ]; $otherstring = q[ my $bigstring="MNRIYSLRYSA..."; my $smallstring="GTMARNDGQGKAA..."; my $lenBig = length $bigstring; my $lenSmall = length $smallstring; for my $o ( 0 .. $lenBig - 1 ) { my $masked = substr( $bigstring, $o, $lenSmall ) ^ $smallstring; my $matched = $masked =~ tr[\0][]; if( ( $matched / $lenSmall ) > 0.90 ) { $masked =~ tr[\1-\255][ ]; $masked =~ tr[\0][*]; printf "%.2f%% match at offset %u\n", $matched / $lenSmall * 1 +00, $o; print substr $bigstring, $o, $lenSmall; print $smallstring; print $masked; } } ]; print compare( $firststring, $otherstring ); __END__ 99.4% plagerised
Original thought is a rare commodity.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Tips on how to perform this regex query
by Anonymous Monk on Jan 12, 2014 at 00:52 UTC | |
|
Re^4: Tips on how to perform this regex query
by Anonymous Monk on Jan 12, 2014 at 00:36 UTC | |
by BrowserUk (Patriarch) on Jan 12, 2014 at 00:47 UTC |