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

If you want to change 45-48 into 45,46,47,48 you can do this.

use strict; use warnings; while ( <DATA> ) { if ( m/^(\d+)-(\d+)$/ ) { for my $value ( $1 .. $2 ) { print "$value,"; } } } __DATA__ 45-48 88-99 102-124
Output 45,46,47,48,88,89,90,91,92,93,94,95,96,97,98,99,102,103,104,105,106,10 +7,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124 +,

Replies are listed 'Best First'.
Re^2: do 45-47 to array 45,46,47
by Hossein (Acolyte) on Jul 01, 2013 at 12:55 UTC

    Thank you :)

    /Hossein