On Sun, Jul 23, 2000 at 05:18:16PM -0400, Jeff Pinyan wrote: > > >> (especially if value happens to be an empty string, since the split would > >> remove the empty trailing fields...). > > > > map {(split /\0/ => $_, -1) [-1]} > > Yup, I know. Sadly, Perl doesn't optimize > > ($a,$b,$c) = (split)[-3 .. -1]; > > the same way it optimizes > > ($a,$b,$c) = (split)[0..2]; # [0..2] optional, I believe... > > And if it DOES optimize this, I am highly unaware. It'd be quite nice of > Perl to do this. How possible is this optimization? I would be very surprised if Perl could. In general, I don't think it possible to extract only the last N fields from a split without creating all the fields, because you will never know how much the regexes consume of the string if you don't start from the beginning. But there might be a way to optimize it if it's determined that the regex doesn't contain any metacharacters. Abigail ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe