in reply to How do I efficiently predeclare a hash with a set of keys
You may be interested in Set::IntSpan from CPAN which will read your sample data format ("5,6,8-53,62-106") directly.