develooper Front page | perl.fwp | Postings from February 2002

Re: TPR0 Final Results

Thread Previous | Thread Next
From:
Prakash Kailasa
Date:
February 19, 2002 06:42
Subject:
Re: TPR0 Final Results
Message ID:
20020219144011.GA32474@seisint.com
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:PKailasa@seisint.com>
==
  echo "Congratulations.  You aren't running Eunice."
               -- Larry Wall in Configure from the perl distribution
==

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About