I just saw this boustrophedon text reader project on freshmeat and 10 seconds later, I had this snippet.
For those who are wondering, here's the definition of the word Boustrophedon:
- boustrophedon (n.)
- bou·stro·phe·don
- an ancient method of writing in which the lines run alternately from right to left and from left to right.
Of course, others have used this ancient method to achieve weird things...
#!/usr/bin/perl
while (<>) {
chomp;
print( ( $. % 2 ? $_ : scalar reverse $_ ), "\n" );
}
Or, for the one-liners/golfers inclined:
perl -npe'chomp;$_=scalar reverse$_ if$.%2;$_.="\n"' file