|
|
| Pathologically Eclectic Rubbish Lister | |
| PerlMonks |
arrays and loop through arrayby RedGrinGo (Novice) |
| on Mar 06, 2011 at 12:17 UTC ( #891672=perlquestion: print w/ replies, xml ) | Need Help?? |
|
RedGrinGo has asked for the
wisdom of the Perl Monks concerning the following question:
Hi All I need to get <STDIN> from a user. the <STDIN> is a range of number delimited by "," (comma) and can be with range delimited by "-". Example: 1,2,3,4-9,12,15,34-36,70 Now I need to get this from the user and go on each number and "Do something"... but when trying to do this as above the loop use the array element as string.
The result of this is: ==>>> 1 ==>>> 2 ==>>> 3 ==>>> 4 ==>>> 6..10 ==>>> 11..15 ==>>> 16 ==>>> 17 and not: ==>>> 1 ==>>> 2 ==>>> 3 ==>>> 4 ==>>> 6 ==>>> 7 ==>>> 8 ==>>> 9 ==>>> 10 ==>>> 11 ==>>> 12 ==>>> 13 ==>>> 14 ==>>> 15 ==>>> 16 ==>>> 17 as wanted... Any suggestions? Thank you all.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||