Tonight at the Amsterdam.pm meeting we tried to make a JAPH with 
certain restrictions. The challenge came from Johan Vromans, who
recently tried to SMS a JAPH, but found himself restricted to not
being able to use lowercase letters.

So, the challenge was set to create a JAPH that doesn't use lower-
case letters. And since forking out to external programs (like echo)
makes the task trivial, use of external programs was forbidden too.

It quickly boiled down to finding a way to eval a string, as putting
text into a variable that prints out "Just another Perl Hacker" is
fairly easy. For quite some time, we were stuck on thinking "eval"
and "s///e" are the only ways to eval a string in Perl - and they
both require lowercase characters.

Then someone pointed out that (?{ }) inside a regex evaluates code too. 
But if (?{ }) is inside a variable that is interpolated in a regex, 
you need a "use re 'eval'", which is all lowercase. However, peeking
inside re.pm learned that the same effect can be archieved by setting
$^H - from a BEGIN block, of course.

So Merijn and I came quickly with similar Japhs:

BEGIN{$^H=2097152}$_="(?\173\160\162\151\156\164'\112\165\163\164\040\141\156\157\164\150\145\162\040\120\145\162\154\040H\141\143\153\145\162\012'\175)";/$_/;

This prints out "Just another Perl Hacker", and is 160 characters - exactly
the maximum amount of characters allowed in an SMS message.


Problem solved? Well, yes and no. It's solved if you look at the set
specifications. But, as we found out, none of our SMS capable phones
makes it { or } available.

So, the challenge is to FWP. Write a JAPH, not using more than 160
characters, no lowercase letters, all used characters should be 
available on most cell phones, and no use of external programs.



Abigail

Reply via email to