#!/usr/bin/perl use strict; use warnings; open INFILE, '; chomp; my @A = split //; $_ = ; chomp; my @B = split //; $_ = ; chomp; my $w = $_; $_ = ; chomp; my $k = $_; close INFILE; my $m = @A; my $n = @B; my %dotplot = (); for (my $i = 0; $i < $m - $w + 1; ++$i) { for (my $j = 0; $j < $n - $w + 1; ++$j) { my $count = 0; for ($l = 0; $l < $w; ++$l) { ++$count if ($A[$i + $l] eq $B[$j + $l]) } $dotplot{$i, $j} = ($count >= $k ? 1 : 0); } } for (my $i = 0; $i < $m - $w + 1; ++$i) { for (my $j = 0; $j < $n - $w + 1; ++$j) { print $dotplot{$i, $j}, ' '; } print "\n"; }