in reply to Re^2: Specifying a range through a variable
in thread Specifying a range through a variable
Update: To return first and last values, obviously:use warnings; my $range = "1..10"; my @wanted = range($range); print "@wanted\n"; sub range { my @t = split /\.\./, $_[0]; return ($t[0] .. $t[1]); }
Cheers,sub range { my @t = split /\.\./, $_[0]; return ($t[0], $t[1]); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Specifying a range through a variable
by dragonchild (Archbishop) on Sep 19, 2008 at 13:40 UTC |