in reply to Declare array with range operator

If you trust the source, then eval:

c:\test>p1 $ips="30..39,50..59";; @array= eval $ips;; print "@array";; 30 31 32 33 34 35 36 37 38 39 50 51 52 53 54 55 56 57 58 59

otherwise parse:

@a = map{ my( $s, $e ) = split '\.\.'; $s .. $e } split ',', $ips;; print "@a";; 30 31 32 33 34 35 36 37 38 39 50 51 52 53 54 55 56 57 58 59

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Declare array with range operator
by mariognarly (Initiate) on Jul 12, 2011 at 19:22 UTC
    Thank you for the prompt response. This is exactly what I was looking for, thanks!