$str = "0,1,2,3,4,FIVE,6,7,8,9,TEN,11,TWELVE,13,14,15,16,17,18"; $str .= ",19,20,TWENTY-ONE,Catch 22"; @a = split (/,/, $str); @b = @a[2,5,7..12,18]; print "\nHere is the slice taken spec: [2,5,7..12,18]\n\n"; foreach (@b) { print; print "\n"; }
[jacobson@math-cs 088]$ perl tryPERLslices.p OUTPUT SHOWN HERE Here is the slice taken spec: [2,5,7..12,18] 2 FIVE 7 8 9 TEN 11 TWELVE 18