in reply to use string as a piece of code

It seems that Set::IntSpan can solve your problem without eval, provided you substitute the .. by - first.
Perl 6 - links to (nearly) everything that is Perl 6.