> ++ColinHorne on a very respectable first Japh!
Many thanks! As you've probably guessed, I'm fairly new to the
monastery (although, I've been lurking for a while), so that's
my first ++ :-)
> Here are a few tips for "golfing" it down, should you desire to make it even more terse, while still preserving the important elements:
I made a re-write this morning, which implemented many of your tips. Still based on the same idea as the old code, though.
#!/usr/bin/perl
$a="cdfh";printf(join("",map{chr(ord)}map({$_^=(split //,$a)[$i++%
length$a]}(map{chr(eval"0x$_")}(("4617460110442c1d101046090d0b120"
."00616463806160a482b05050306166c")=~/../g)))),$a)#GPL:Colin Horne
I think there's only one pair of parenthesis which can be taken out, which are around chr(ord). I decided to keep them in, though, since the formatting is quite nice at the moment, and removing them would mess that up a bit :-)
> 6. You have a string concatenation which seems unnecessary, and saves 3 characters ('"."')
I left that in on the re-write, so that I could keep the col-width under 70 (there can't be a newline character in the string). Shoot me if there's a nicer way to do that, though :-)
My exam's in a few days time, but after that I will have another go at re-writing it, and will hopefully get 'round to making an explanation page (for those who aren't wizards like yourself :-) ).
Anyway, many thanks for your help! Hopefully you can expect me to be active more, and lurk less in the near future :-D
Cheers!
Edit: Actually, it seems there was quite a bit I could strip out from this mornings code ;-) This is the updated version:
#!/usr/bin/perl
map{print chr ord}map{$_^=qw{c d f h}[$a++%4]}map{eval"chr 0x$_
"}"2911151c43050807170c031a4334031a0f442e09000f031a4f6e"=~/../g
Changed the output a bit, since I wasn't too sure if it was considered arrogant for one to label himself directly (also, it made the code slightly shorter to strip that out!).