http://www.perlmonks.org?node_id=1041848


in reply to do 45-47 to array 45,46,47

Or with eval:

use strict; use warnings; my $_ = "45-48, 88-99, 102-124"; my @result = map { s/-/../; eval $_ } /(\d+-\d+)/g; print "@result\n";