#!/usr/bin/perl # http://perlmonks.org/?node_id=1174957 use strict; use warnings; use Algorithm::Diff qw(traverse_sequences); my $template = < sub { $changes++ }, DISCARD_B => sub { $changes++ }, } ); return $changes; }; my $length = length $template; print "length: $length\n"; my $answer = compare($template, $copywitherrors); my $ratio = $answer / $length; printf "copywitherrors: %d ratio %.3f\n", $answer, $ratio; $answer = compare($template, $somethingelse); $ratio = $answer / $length; printf "somethingelse: %d ratio %.3f\n", $answer, $ratio;