sub compatible { my ($s1, $s2) = @_; my($c1, $c2, $d); { $s1 =~ /(.)/gs or return 1; $c1 = $1; $s2 =~ /(.)/gs or return 1; $c2 = $1; if ($c1 eq "_") { if ($c2 eq "_") { } else { vec($d, ord $c2, 1)++ and return; } } else { if ($c2 eq "_") { vec($d, ord $c1, 1)++ and return; } else { $c1 ne $c2 and return; vec($d, ord $c2, 1)++ and return; } } redo; } } printf "%s v %s ? %s\n", @$_, compatible( @$_ ) || 0 for [ qw[ _8__3__19 48____7__ ] ], # compat [ qw[ _8__3__19 4_2___7__ ] ], # compat [ qw[ _8__3__19 4_8___7__ ] ], # clash [ qw[ __8_3__19 48____7__ ] ], # clash [ qw[ __8_3__19 84____7__ ] ], # clash [ qw[ _8__3__19 48_____7_ ] ]; # clash