On Tue, Feb 19, 2002 at 01:27:52AM +0100, Philippe 'BooK' Bruhat wrote:
> On Sat, 16 Feb 2002, Paul Johnson wrote:
>
> > On Fri, Feb 15, 2002 at 11:47:27PM +0000, Stephen Turner wrote:
> >
> > > Well, I repeat my challenge. Can anyone beat Karsten's 46 without using
> > > POSIX?
> >
> > I think my entries must have been late, but here's a 41.
> >
> > #!/usr/bin/perl -l
> > $_=pop;print/A/?360:/B/?47:/Z/?46655:1
> > __END__
>
> One char shorter... but still cheating ;-)
>
> #!/usr/bin/perl -l
> print{1,1,A,360,B,47,Z,46655}->{+pop}
This would fail the test program. You need to change it to:
#!/usr/bin/perl -l
print{1,1,A0,360,'1B',47,ZZZ,46655}->{+pop}
which would make it 46 chars.
Stephen's "cheating" works because he is using regexes and the base36
values in the test program favored his approach so he could manage
with single character regexes.
/prakash
--
Prakash Kailasa <mailto:[EMAIL PROTECTED]>
==
echo "Congratulations. You aren't running Eunice."
-- Larry Wall in Configure from the perl distribution
==