"Rob Dixon" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > Hi Bryan > > "Bryan Harris" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > I need to slice an array such that it gives me the first through the 4th > to > > last in a variable length array. I thought I could just do: > > > > @comments[0..-4] > > > > but Perl seems to choke on this. It's perfectly okay with a slice using > two > > negative #s: > > > > @comments[-2..-4] > > > > Anyone know why it doesn't like 0..-4? > > You're using the range operator '..' to generate a list of indices for the > slice. This operator always counts upwards, so if the first operand is > greater than the second it will return an empty list. -2 .. -4 is the same > as (-2, -3, -4), but 0 .. -4 is ().
What nonsense! -2 .. -4 is () -4 .. -2 is (-4, -3, -2) /R -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]