in reply to Finding common substrings

if($a =~ /[$b]/) { print "true \n" };

UPDATE

Just Ignore my Code, this's totally wrong, i'm sorry, (maybe i'm too tired)