in reply to Converting String Containing Ranges to Array

It seems like this may be an XY Problem, but you can accomplish your goal simply using eval because your string contains valid Perl syntax. Be aware that if this string comes from a potentially untrusted source, using eval will hand over the keys to the kingdom.

my $string = "1,5,7..10,15,17..19,22"; my @array = eval($string); print join ", ", @array;

On a side note, please wrap code, input and output in <code> tags - it makes your life and our lives easier. See Writeup Formatting Tips.