$x[12]=$x[123]=$x=$_=""; print "match one\n" if /$x[123]/; print "match two\n" if /$x[12]/; #### /* This is the one truly awful dwimmer necessary to conflate C and sed. */ ... /* this is terrifying, and it works */ int weight = 2; /* let's weigh the evidence */ [almost 100 lines of scary code snipped] if (weight >= 0) /* probably a character class */