#!/usr/bin/perl -wl use strict; sub is_compatible { local $_ = $_[0] ^ $_[1]; return not (/[\001-\017]/ or /([\020-\031]).*?\1/s); } print is_compatible (' 8 3 19', '48 7 ') ? 'yes' : 'no'; print is_compatible (' 8 3 19', '4 8 7 ') ? 'yes' : 'no'; print is_compatible (' 8 3 19', '48 7 ') ? 'yes' : 'no'; __END__ # output yes no no