perl -wle '$a="abcdXXX"; $b="abcd"; $c = sub{$_[0] =~ s/X+$//g}; $a->$c; $b->$c; print "yes" if ($a eq $b); print "$a $b"; '