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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Boustrophedon
by japhy (Canon) on Nov 19, 2001 at 06:25 UTC | |
Re: Boustrophedon
by petral (Curate) on Nov 19, 2001 at 20:32 UTC |
Back to
Cool Uses for Perl