my %g = ( k => [8, 2, 10, 2, 1, 3], l => [10, 7, 9, 0, 1] ); #### use 5.014; no warnings; # some non-sensical combination of sigils would give warnings use strict; # we want answers without symbolic references my %g = ( k => [8, 2, 10, 2, 1, 3], l => [10, 7, 9, 0, 1] ); sub sigil_combination { sprintf("%X", $_[0]) =~ y/0-9A-F/$@#%*~^\->(){}.,;/r; } for my $n0 (1..1e5) { my $c = "length " . sigil_combination($n0) . "g{k}"; if (6 == eval $c) { say "$c"; } } __END__ #### length ~$~#g{k} #### length {}%$g{k} length {}%@g{k} length {}-$g{k} length {}-@g{k}