|Syntactic Confectionery Delight|
printing every 2nd entry in a list backwardsby Anonymous Monk
|on May 19, 2017 at 11:52 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
lowly Perl apprentice here with a question regarding list traversal.
I chanced upon this code written in a lesser language:
Being ever curious I wondered how this could be done in Perl.
Trying to wield what little power of Perl I possess, I came up with the following:
The task seems simple at a glance:
Given a line of numbers from a file, print every 2nd number starting from the back.
1 22 3 -4 ==> -4 22
Are the esteemed monks able to enlighten me with a solution that is better and more performant?
Faithfully yours,Perl apprentice