# predefine $testlist as a simple string of the set of acceptable characters then 'index' => sub { $test_char = chr( int( rand 256 ) ); if (index($testlist, $test_char) > -1 && length($test_char)==1) {} else {} },