· Offer Kaye > Perl > Reverse Line Order
Explanation of 'Reverse Line Order' Perl oneliner
Here is the code again: perl -e'print reverse<>'
"reverse<>" - since reverse is in the list context provided by "print", it will return a list value consisting of the elements
of <> (the input lines) in the opposite order.
"print" will print the list returned by "reverse".
Usage Example
Given an input file called "example" with the contents:
a
b
c
d
Then running the following from the command line:
perl -e'print reverse<>' example
will print to STDOUT the following four lines:
d
c
b
a
Offer Kaye /
To contact me, email me at: offer.kaye no spam at gmail dot com /
Last Modified: Thu Jul 15 23:04:09 2004