Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Boustrophedon

by OeufMayo (Curate)
on Nov 19, 2001 at 05:20 UTC ( #126195=snippet: print w/ replies, xml ) Need Help??

Description:

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
  1. 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
Comment on Boustrophedon
Select or Download Code
Re: Boustrophedon
by japhy (Canon) on Nov 19, 2001 at 06:25 UTC
    My preferred flip-flop is $|:
    perl -lpe'$_=reverse if--$|'

    _____________________________________________________
    Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
    s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Re: Boustrophedon
by petral (Curate) on Nov 19, 2001 at 20:32 UTC
    Further pedantry:
    Boustrophedon is greek for "as the ox plows".
    When the alphabet was first borrowed from the right-to-left writing Phoenicians, there was a brief period (c. 8-700 roman bc?) during which this form of writing was actually used by Greek writers before they settled on writing left-to-right.
    The word was borrowed from the classicists when mechanical printers appeared.  These printers could clearly go faster if they started each line where they had ended the previous one (which, of course, is also true of oxen).

      p

        tfl;dr

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://126195]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2014-08-27 12:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (238 votes), past polls