Perl-Sensitive Sunglasses | |
PerlMonks |
Re^2: Printing Last Element of a line using perl memory?by jaredor (Priest) |
on Feb 15, 2013 at 18:12 UTC ( [id://1018937]=note: print w/replies, xml ) | Need Help?? |
++ for the END block idea. A further tweak would be to not process data in the main loop, but only the END block. Unfortunately I could not think of a slick way to make $_ available to END from the last loop iteration, so I had to cheat a little to golf your solution. Apparently the autosplit array does remain resident: perl -nae 'END { print "$F[-1]\n"; }' scan.logGood examples like yours are weaning me from sed ;-)
In Section
Seekers of Perl Wisdom
|
|