Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

JAPH from keywords and functions

by trizen (Friar)
on Nov 28, 2011 at 21:14 UTC ( #940470=obfuscated: print w/ replies, xml ) Need Help??

Who said that Perl doesn't have a clean syntax? :)
join eval tell rand reverse ord chr eval split xor uc prototype eval lcfirst join chmod kill eval ref split sprintf reverse times xor not eval and srand tell sqrt formline eval ord lcfirst ucfirst length glob gmtime exp defined caller or binmode log ord abs lc sqrt study alarm split time or formline cos ne rewinddir kill chdir reset prototype split sqrt ord int localtime abs oct pack pop eq scalar print telldir open unpack return and unlink write chroot hex bless utime split chown split close rmdir join exp fileno getc sleep redo glob mkdir stat ne pack reverse getpwnam next lstat gethostent and getpgrp eq log ord time xor chr undef and eval caller and printf srand lstat chown chdir syscall open select eq -w closedir sleep chr split and quotemeta reset require ne closedir sleep chr undef or pack unpack length splice shift umask readpipe pos xor defined join system and die or do exit if defined require hex defined undef or sprintf localtime cmp time or abs time and undef and open exp getc fileno system caller eof rewinddir readpipe splice shift defined kill pop wantarray and readlink eof readpipe split eval warn join study abs localtime oct log time or reverse xor open 0; print chr ord while readline 0 ,;print chr abs length time for cos length getppid

P.S. Tested only with perl 5.14.2 and 5.15.5.

Edited: Warnings free; Added a comma and a new line.

Comment on JAPH from keywords and functions
Download Code
Re: JAPH from keywords and functions
by cavac (Chaplain) on Nov 28, 2011 at 22:41 UTC

    Hmm, doesn't seem to work on Perl 5.12:

    Type of arg 1 to push must be array (not string eq) at + line 12, near "gethostent and" Type of arg 1 to unshift must be array (not quoted execution (``, qx)) + at line 17, near "pos xor" Type of arg 1 to shift must be array (not umask) at li +ne 17, near "pos xor" Type of arg 1 to splice must be array (not shift) at l +ine 17, near "pos xor" Type of arg 1 to pop must be array (not wantarray) at +line 22, near "wantarray and" Type of arg 1 to shift must be array (not kill) at lin +e 22, near "wantarray and" Type of arg 1 to unshift must be array (not shift) at +line 22, near "wantarray and" Type of arg 1 to splice must be array (not unshift) at + line 22, near "wantarray and" Execution of aborted due to compilation errors.

    Here's the perl version i'm using:

    cavac@planetx:~/src/temp$ perl -V Summary of my perl5 (revision 5 version 12 subversion 3) configuration +: Platform: osname=linux, osvers=2.6.11-1.1369_fc4, archname=x86_64-linux-thre +ad-multi uname='linux perl-linux64-vm 2.6.11-1.1369_fc4 #1 thu jun 2 22:56: +33 edt 2005 x86_64 x86_64 x86_64 gnulinux ' config_args='-ders -Dcc=gcc -Dusethreads -Duseithreads -Ud_sigsetj +mp -Uinstallusrbinperl -Ulocincpth= -Uloclibpth= -Duse64bitall -Dlibp +th=/lib64 /usr/lib64 /usr/local/lib64 -Accflags=-DUSE_SITECUSTOMIZE - +Duselargefiles -Accflags=-fno-merge-constants -Dprefix=/home/cavac/bi +n/ActivePerl-5.12 -Dprivlib=/home/cavac/bin/ActivePerl-5.12/lib -Darc +hlib=/home/cavac/bin/ActivePerl-5.12/lib -Dsiteprefix=/home/cavac/bin +/ActivePerl-5.12/site -Dsitelib=/home/cavac/bin/ActivePerl-5.12/site/ +lib -Dsitearch=/home/cavac/bin/ActivePerl-5.12/site/lib -Dsed=/bin/se +d -Duseshrplib -Dcf_by=ActiveState +' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=und +ef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DUSE_SITECUSTOMIZE + -fno-merge-constants -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE +-D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -DUSE_SITECUSTOMIZE -fno-merg +e-constants -fno-strict-aliasing -pipe' ccversion='', gccversion='4.0.0 20050519 (Red Hat 4.0.0-8)', gccos +andvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags ='' libpth=/lib64 /usr/lib64 /usr/local/lib64 libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/, so=so, useshrplib=true, libperl=libperl.s +o gnulibc_version='2.3.5' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E - +Wl,-rpath,/home/cavac/bin/ActivePerl-5.12/lib/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_64_ +BIT_ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 1204 [294330] c6fbf28 [perl #71806] perldb does not setup %dbline with the sheba +ng option -d 1fd8fa4 Add Wolfram Humann to AUTHORS f120055 make string-append on win32 100 times faster a2a8d15 Define _USE_32BIT_TIME_T for VC6 and VC7 007cfe1 Don't pretend to support really old VC++ compilers 6d8f7c9 Get rid of obsolete PerlCRT.dll support d956618 Make Term::ReadLine::findConsole fall back to STDIN if /de +v/tty can't be opened 321e50c Escape patch strings before embedding them in patchlevel.h Built under linux Compiled at Feb 9 2011 14:48:47 @INC: /home/cavac/bin/ActivePerl-5.12/site/lib /home/cavac/bin/ActivePerl-5.12/lib

    Don't use '#ff0000':
    use Acme::AutoColor; my $redcolor = RED();
    All colors subject to change without notice.
Re: JAPH from keywords and functions
by zentara (Archbishop) on Nov 29, 2011 at 12:48 UTC
    It works here on 5.14.1. Very cool.

    What I want to know, is how did you come up with this? What goes on in your mind? :-)

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re: JAPH from keywords and functions
by eyepopslikeamosquito (Canon) on Nov 29, 2011 at 20:33 UTC
Re: JAPH from keywords and functions
by chrestomanci (Priest) on Dec 02, 2011 at 22:17 UTC



    Very impressive. It is a shame it only works on the most recent perl releases, presumably because of the new feature where functions that take arrays etc can also take references to those types.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://940470]
Front-paged by Eliya
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2014-11-26 08:13 GMT
Find Nodes?
    Voting Booth?

    My preferred Perl binaries come from:

    Results (164 votes), past polls