Short punctuation japh
1 direct reply — Read more / Contribute
|
by monsoon
on Jun 19, 2012 at 21:36
|
|
|
160 characters, clean under strict and warnings, works on win and *nix
*==~/(.).(.)/;($:,$:,$:,$;,$;,$,,$,,
$,,$@,$@,$^,$~,$.,$\,$/,$_,$.,$.,${{},$_[$|],$})=$+..-
$+;`$;$:$,$/$"$@$}${{}@_$"$+$\$/@_$,$;$.$"$_$;$.$~$"$,$+$:$^$;$.>&$#+`
|
Making code less fun to read
1 direct reply — Read more / Contribute
|
by thomas895
on Jun 01, 2012 at 14:27
|
|
|
I just turned 15 yesterday, so I thought I'd make a little something.
On an unrelated note, school ended yesterday as well, so it's not like I was bored or anything ;-)
Enjoy!
f(e( ));sub a{%cp=
(''. '131',[8,3 ],
'1'. '30',
[2], '12'.
'2', [21],'129',[
15, 11,
23], ''.
'1'. '19',[9,18],
'1'. '16', [10,22,14], '125', [6],'1'. '26', [7],'1'. '23
+', [16],
'2'. '5',[ 25], '95', [13], '61', [24
+],
'114',[20], '47',[4,17 ,12],'112',[19, 5],'' .'1
+32',[1],
'89', [0] ) ; %cp; }sub
+ b {
15;} sub c{ $e= $_[0] -15; $e;}
+ sub d
{chr ($_[
+0]);}sub
e {
%cp = a();
@cs=();foreach(keys %cp){my$av=c($_);my$cv=d($av);foreach(@{$cp{$av
++15}}){
$cs[$_]=$cv;}}return@cs;}sub f {print join( "", @_ );print "\n";}
~ Thomas~
bless( $you ) if $you->{sneezed};
|
5 little blocks of code
4 direct replies — Read more / Contribute
|
by thomas895
on May 29, 2012 at 15:54
|
|
|
5 little blocks of code
Happy as can be.
Along came the IDE
and formatted them into three.
Along came the inter-preter
who didn't like this a bit.
So it went ahead
And put them all back.
On to Perl-Monks this little script went
Aspiring to be famous
For this rhyme that makes no sense!
g(f());sub a{"1722152". "132141301952082092142". "021992121301781992
+122". "061302021951972051992". "12144108";}sub b {
length(scalar(shift));} sub c{98;}sub d {3;}sub e{return $_[0]+d();
+}sub f{my $h = b(a());my @i = ();my $j=0;while($j
<$h){my $k=sprintf('%d' ,substr(a(),$j,d));push (@i,chr($k- c));$j=
+e($j );}return@i;}sub g{abcd( join("",@_)) }sub
abcd{ print @_
+ ; }
~Thomas~
I believe that the source code to life is written in Perl :-)
|
Pixel art
1 direct reply — Read more / Contribute
|
by Grimy
on May 18, 2012 at 09:21
|
|
|
eval'op
e PnY+0;opPen
*XP PYH,">$0.bmp"
;XprPiYnt(KHY+pack
"XsxPY8Kl2s4a*(YH24
)X*PXPYL",19K778,7Y4,
1X2,PXPL24,32,K1,4,uYn
pXaPXcPLk("u",uKc"p_/
sX[PX^-Pj=L0d7l3K+i?,v
_Xrko3[aruPe=LanzgK%7=u
)X<=y;/RXR RL_"),sPort
{X1}grepRN{ RLs/P.\n
/X\t/;Rs N RP/\
HX/\t/R; N RX0u
ntXil!sR/(N RX.)
[JPX!-I RZO X-~]
/JP$X1$R1QO X/}<
0J>PX)&&NQ XqqP:
|J&&PX::; X'=~s/
|[JfhPX\uj-\uyPX:|
qw`&JAPX]//gr#xP/
#MP[\J]PEFXGHIP/
#MP{}JP P__/
#MZPAC|
#MPDB/
#MZP|
#MP|
#Mw|
#Mw|
#M/
#/
#
Generates this pixel art of Rainbow Dash (it will be named "$0.bmp"). Requires Perl v5.14 (see below for a more compatible version).
Can't be run from the command line, must be stored in a file (without trailing newlines).
Strict and warning compliant.
Only tested under Strawberry Perl.
|
A Simple JAPH
1 direct reply — Read more / Contribute
|
by Athanasius
on May 07, 2012 at 12:02
|
|
|
$_='penflillggplmhlllpkolhmhgiokmpmhkegopckdlmlckemhge';
tr/g-p/0-9/;my@x=map{-84+hex$_}$_=~/[A-F0-9]{2}/gi;my@y=
shift@x;push@y,$_+$y[-1]for@x;print join'',map{chr$_}@y;
“...an ill-favoured thing, sir, but mine own.” —As You Like It (Act 5, Scene 4)
Regards,
Athanasius <°(((>< contra mundum
|
How to (ab)use sort
3 direct replies — Read more / Contribute
|
by Grimy
on Apr 17, 2012 at 04:56
|
|
|
sort is, like, the single most abusable function in all of Perl. Seriously, side effects in the sorting code!
use strict;
use warnings;()=
sort{index+0x47,&$a($b)}sub{print&{;pop}},
sort{sub J{$!++&1}[0]}sub{exec''},map{@$_}
sort{sub _{[(pop)x((1<<$!-->>47)|1)]}!{()=
sort{my$_=$a;$a=_(sub{$_})if!/0/}$a,$b,0}}
sort J('rke%ca hlrPe rhetoan tus;J')=~/./g
Obviously, this code depends on the internal, unspecified implementation of sort. I only tested it on Strawberry Perl 5.14.2 (64 bits); please let me know whether it works anywhere else.
Edit: minor code improvements.
|
Flickering japh
1 direct reply — Read more / Contribute
|
by Grimy
on Apr 13, 2012 at 09:40
|
|
|
(Original concept by davido)
use strict;for(q)Just another Perl hacker)){$|^=@_=map{sub{[sub{$^N^(
pop&&q q q||qq qq)if/\G(.)/g}->((*0=sub{rand})->()<1e-2)||q$,$,$!+++&
0**-.2]}}/./mg=>$<;for(;;){my$_;{print+map{$_->[0]}@{[[qq]\xD]],sort{
$a->[1]<=>$b->[~0]}map{$_->$_}@_=>]}}select$_->[0],$,,$,,&0**5;die:}}
Edited to avoid the warning.
|
My first JAPH
No replies — Read more | Post response
|
by stevieb
on Apr 01, 2012 at 23:08
|
|
|
It has taken me a few years to get to this point, and I know I still have an infinite amount of learning to do, but here is my first japh that I feel somewhat comfortable with posting :)
use 5.10.0;
$p=japh;push@a,w();$s=j4;sub n{"8fbac6c6e252"};unshift@a,
"b4d6c7ea52a7";$k=crypt($s,$p);$o="aeafa7cfdbd58c";@h=
map{sprintf"%x",ord($_)}split//,$k;push@a,$o;$a[3]=pop@a;
$a[2]=n();sub w{"bcb3d8dec8dd"}$x.=$_ for@a;@b=($x=~m/..?/g);
push@z,@h until @z>@b;for(@b){push@japh,hex($_)-hex($z
[$n]);$n++;}say map{chr$_}@japh;
|
JAPH from subs
No replies — Read more | Post response
|
by trizen
on Mar 30, 2012 at 18:19
|
|
|
print"@{sub hacker;[grep{sub Just;$::{$_}eq-1}keys%::
];sub Perl}[!!_+(++${sub another;_}),$?,//,$#$],$/";;
|
what is the force?
No replies — Read more | Post response
|
by tobyink
on Mar 19, 2012 at 12:15
|
|
|
use Acme::What;
use junk JElOQ3siZm9yY2UucG0ifT1fX0ZJTEVfXztvdXIkeDsqV0hBVD1zdW
. J7cHJpbnQiJHgKIn07KmZvcmNlOjp0aGU9c3ViOmx2YWx1ZXskeH0K;
use the force;
the force = strong;
what is the force?
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
|
|