Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: do 45-47 to array 45,46,47

by rnewsham (Curate)
on Jul 01, 2013 at 12:35 UTC ( [id://1041836]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1041836]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-29 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found