Re: array slice question

2001-06-26 Thread Michael Fowler
On Tue, Jun 26, 2001 at 04:46:24PM -0400, Bradford Ritchie wrote: > ...but I really need to print everything after the 8th element. If the > ...array were named, I could do something like this: > > @arr = split(/:/); > print @arr[1,6,8..$#arr]); Your asked question was answered well by St

RE: array slice question

2001-06-26 Thread Peter Cornelius
I don't think so. I do (split)[-1] regularly and it works fine. If you left out the parens however it would think this was a pattern to match. I was told by someone on perlmonks that the failure of [3 .. -1] with split is something that should be fixed in subsequent versions of Perl. > > [

Re: array slice question

2001-06-26 Thread royce . wells
[1,6,8..-1] in this case "-" is seen as a metacharacter inside the character class and is not seen as -1 Hi, I have an unnamed array which I created from splitting up a colon separated string: $_ = "0th:1st:2nd:3rd:4th:5th:6th:7th:Some random text: might have :colons: or might n

Re: array slice question

2001-06-26 Thread dave hoover
Bradford wrote: > Hi, > > I have an unnamed array which I created from > splitting up a colon separated string: > > $_ = "0th:1st:2nd:3rd:4th:5th:6th:7th:Some > random text: might have :colons: or might not" > print ((split /:/)[1,6,8]); > > ...but I really need to print everythi

RE: array slice question

2001-06-26 Thread Stephen Nelson
field are not field delimiters, but just part of the text. Other than that, you may need to bite the bullet and name the array. > -Original Message- > From: Bradford Ritchie [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 26, 2001 1:46 PM > To: [EMAIL PROTECTED] > Subj

array slice question

2001-06-26 Thread Bradford Ritchie
Hi, I have an unnamed array which I created from splitting up a colon separated string: $_ = "0th:1st:2nd:3rd:4th:5th:6th:7th:Some random text: might have :colons: or might not" print ((split /:/)[1,6,8]); ...but I really need to print everything after the 8th element. If the ar