in reply to (TIMTOWTDI / Golf / Obfu) Airplanes in class
Oh, and I nearly forgot the ob. version using an XML-based language, interpreted of course using XML::Twig:
#!/usr/bin/perl -w use strict; use XML::Twig; eval script2perl( XML::Twig->new->parse( \*DATA)); sub script2perl { my $t= shift; foreach my $for ($t->findnodes( '//for')) { if( my $range= $for->att( 'range')) { $for->prefix( "for ($range) {\n") ->suffix( "\n}\n") ->erase; } } foreach my $print ($t->findnodes( '//print')) { $print->prefix( q{ print "}) ->suffix( q{";}) ->erase; } return $t->root->text } __DATA__ <script> <for range="1..500"> <print>I will not throw paper airplanes in class.\n</print> </for> </script>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: (TIMTOWTDI / Golf / Obfu) Airplanes in class
by Juerd (Abbot) on Oct 03, 2003 at 17:01 UTC |