my $sep = "\x01"; my @list = ('jumping turtle', 'frog!', 'tad?pole'); for my $var (@list) { if (join($sep, '', @list, '') =~ /\Q$sep$var$sep\E/) { print "Found $var\n" } else { print "Didn't find $var\n" } }