sub compatible { my ($s1, $s2) = @_; $s1=~/\G_/gcs and $s2=~/./gcs or $s1=~/./gcs and $s2=~/\G_/gcs or return 0 until $s1=~/\G\z/ or $s2=~/\G\z/; 1; } print(compatible("_8__3__19", "4_8___7__") ? "true\n" : "false\n");