http://www.perlmonks.org?node_id=177952


in reply to Somersaulting camel

Update: Creating an EyeDrops-generated camel inevitably degenerates into a golf crack-pipe smoking session on the source text. So it has proved here. Golfing the original source program has allowed me to support a new 'back-flip' command-line argument as follows:

perl camel.pl camel forward somersaults as before perl camel.pl b camel somersaults backwards perl camel.pl please do a backward somersault same thing camel.pl: (Save all text between the ------ lines below) ------------------------------------------------------------------ ''=~('(?{'.( ('`')| '%').('['^'-'). ('`'|'!'). ('`'|',').'"\\$~=' .('['^'+') .('`'| '/').('['^'+').'||'. "'"."'".';'.('`'|'/' ).('['^'+').('`'|'%'). ('`'|'.').('\\$%;').( '['^'"').(',!-~,#,,').( '['^'(').',(.).,\\' .'$+,'.('`'|"'").('['^'(') .',\\$~&&(\\$' .'_='.('['^')').('`'|('%')).( '['^'-').('`'| '%').('['^')').('['^'(').(('`')| '%').')'.("\`"| '&').('`'|'/').('['^"\)").'\\@~='.( '`'|"'").("\["^ ')').('`'|'%').('['^'+').('\\$|--,('). "'"."'".(')').( '['^'#').('^'^('`'|'/')).(':'&'=').',<'. ('^'^('`'|'.') ).'>;\\@;='.('`'|'-').('`'|'!').('['^'+') .'~~'.('['^')' ).('`'|'%').('['^'-').('`'|'%').('['^')'). ('['^'(').('`'|'%').','.('['^')').('`'|'%').('['^'-').('`' |'%').('['^')').('['^'(').('`'|'%').'\\@~;'.('`'|'-').('`'| '!').('['^'+').'\\{'.('['^'(').('['^'"').('['^'(').(('[')^ '/').('`'|'%').('`'|'-').'\\$^'.('`'^'/').'=~'.('{'^"\,").( '`'|')').('`'|'.').'?'.('`'^'#').('`'^',').('{'^'(').(':'). "'".('`'|'#').('`'|',').('`'|'%').('`'|'!').('['^')')."'". ';(\\$-=\\$_%'.('^'^('`'|'-')).')||(--\\$|,'.('`'|'-' ).( '`'|'!').('['^'+').'\\$_='.('['^')').('`'|'%').('[' ^(( '-'))).('`'|'%').('['^')').('['^'(').('`' |('%')). ',' .'\\@~,\\@;);'.('['^'+').('['^(')')).( '`'|')' ).( "\`"| '.').('['^'/').'\\$\\"'.("\["^ ('#')). '(' .'\\$=/'.('^'^('`'|'-')).'*'. (('`')| '!' ).("\`"| '"').('['^ "\("). '\\$|' .+ ('*').( '^'^('`' |',')) .'-\\' .+ '$-),'. '\\$_,'. '\\$' .'/'. ( ('`')| ('&')).( '`'| '/') .('['^ ')').'\\' .'$' .'-' .'&'. (('^')^( '`'| '/') ).'?' .'\\@;' .':' .''. '\\' .'@~;' .''. ('[' ^'(' ).( '`'| ',') .''. ((( '`' ))| '%' ).( '`' |(( '%' ))) .+( '[' ^(( '+' ))) .+ (( '!')). (( (( '\\') )) ). '$%\\}'. (( ((( '\\' ))))) .+ '$' .'%..' .''. ((( '^') )^("\`"| '/' )).( "\^"^( ('`')| ('/'))). '"})'); ------------------------------------------------------------------

camel.pl above was created with:

perl gencamel.pl >camel.pl

where gencamel.pl is:

use Acme::EyeDrops qw(sightly); my $src = <<'END_SRC_STR'; $~=pop||'';open$%; y,!-~,#,,s,(.).,$+,gs,$~&&($_=reverse)for@~=grep$|--,('')x18,<0>; @;=map~~reverse,reverse@~; map{system$^O=~Win?CLS:'clear'; ($-=$_%3)||(--$|,map$_=reverse,@~,@;); print$"x($=/3*abs$|*2-$-),$_,$/for$-&1?@;:@~; sleep!$%}$%..11 END_SRC_STR $src =~ tr/\n//d; my $prog = sightly( { Regex => 1, Compact => 1, Shape => 'camel', SourceString => $src } ); my @a = split(/\n/, $prog); my $max = 0; length > $max and $max = length for @a; $_ .= ' ' x ($max - length) for @a; print " $_ \n" for @a;

One more thing: camel.pl should still work if you add a leading #!/usr/bin/perl -w line followed by a single blank line; if you don't add the blank line, the camel may lose one eye and somersault erratically.