Perl allows you to use the ‘..’ operator to return a slice from an array. So if I wanted cells 4 through 8 from an array, I could this:
sample_array[4..8]
And if I assigned that to a new array, it would only have those 5 cells. Is there an operator like this for Ruby?
Thanks.
You answered your own question. The Array#[] method can take a range, and return slices of that array.