MyCanon.pm


   1 sub canon {
   2 	my $v=shift;
   3 	$v =~ s/\W//; # remove non-word chars
   4 	join '', sort split '', lc $v # Must lc before sort
   5 }
   6 
   7 sub subtract { # letter sequences
   8 	my ($longer, $shorter)=(@_);
   9 	my $difference=$longer;
  10 	foreach my $c (split '', $shorter) {
  11 		$difference =~ s/$c//
  12 				 
  13 	  ## Does NOT check for propersubset as original did	
  14 	}
  15 return $difference;
  16 }
  17 
  18 sub adjacent_pattern {
  19    my $input=shift;
  20    return join '|', map {my $x=$input; substr($x,$_,1)=q{.};$x} 0 .. length($input)-1;
  21 }
  22 
  23 1; # Return true like every good module
  24