Shawn H Corey wrote:
> On Thu, 17 Jul 2014 17:36:28 +0300
> Lars Noodén <lars.noo...@gmail.com> wrote:
>
>> David's example with the autosplit seems much better but if a slice
>> were done instead, what would be the more elegant (least inelegant?)
>> way of doing it?
>
> I wouldn't use a slice at all:
>
> perl -nE'say((split/\s+/)[-1])' file
>
>
> --
> Don't stop where the ink does.
>       Shawn

You say you wouldn't use a slice but then go ahead and use a slice?

According to the perldata documentation, that is a list slice.  Maybe you
meant to say you wouldn't use an array slice?

---
Ron Bergin


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to