Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation


by Jasper (Chaplain)
on Feb 15, 2002 at 17:13 UTC ( #145724=user: print w/replies, xml ) Need Help??

I have been programming in perl for several years.

I like programming in perl.

This is my most upvoted node. And my first post, too. I hadn't learnt how to create a user account at that state. (Boy, does it look bad now - must revisit it at some stage to fix bugs, and shorten it a bit)

Maximillian tells me to do horrible things. I try to ignore him.

If anyone remembers a webcomic of the early 00s called 'Trevor the cat' that was me.

I like the trickery of perl golf..

Here's a thing to print out all the valid permutations of a number of pairs of parentheses (don't try it on a number bigger than 7, it's also quite a good machine killer):

$c-=fork?$c?s//(/:exit:- s//)/for($_)x(2*pop);$c||print

This won me $25 in the fonality competition:

-lp map{y/IVXLC/XLCDM/,s!\d!$&^4?$&^9?V x($&>3).I x($&%5):IX:IV!ewhile//;$$_=$n++}@d=0..4e3;y/m/-/;s/\w+/+${$&}/g;$_=$d[eval]

Although I completely missed the excellent trickery of 4x$&%1859^7 which might have saved me four or five strokes!

Some of my other solutions (prizes for working out what the problem was!)
-lpaF| for$i(0..19){$s{$_ x($i>13).($i%7).$_ x($i>6&$i<13).(6-$.).$_ x($i<6)}|=$F[$i]for 0..5}}{$_=grep/X/,%s

pos=$i++/2,//g,print"$`",$_=reverse,/^$'/?$/:redo for pop

-l $k=(pop)x99;print+map{$k=~s///;(uc..Z,@a=A..$&)[$#a]}<>=~/\pL/g

$_=$"x map$b.='-',2..pop;$t=$t?"$`/$_/$'| $t |$_|$'/":"+$b+$_+"while//g;print" $_+$b+ $t +$b+ "

print map"@{['### ## # #'=~/.../g]}[(/./g)[@_]] ",-1003e5,3111322133,31e8|100,3121113131,-10x4 if split'',pop

-lp $;+=y/.:|-/125/d?$_:19*$;for/./g;$_=$

-p0 sub g{my($b,$r)=@_;$s{$b}++||map{$p='.'x8x/[A-Z]/;$s||=$r x$b=~/$c /||g($n=$b,"$r$c ".($n=~s/$_(($p$c)+$p)(?!$_)($c| )/$3$1$_/s-2*/ /).$/ +)for$",$c=$_}$b=~/\w/g;$s}$_=g$_

p.s. if you recognize the Maximillian action figure from the Black Hole, you might be interested in joining my Yahoo group for collecting like stuff (group)

Log In?

What's my password?
Create A New User
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-05-25 18:54 GMT
Find Nodes?
    Voting Booth?