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

Problem: You are given the input string "88-99", and you need to output each number from 88 to 99, inclusive.

$ perl -E'my ($lower, $upper) = split(/-/, pop); say for $lower .. $up +per' 88-99 88 89 90 91 92 93 94 95 96 97 98 99

The key here is the range (..) operator. From perldoc, the range operator returns a list of values counting (up by ones) from the left value to the right value.

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