Re: Shortest non-numeric Perl expression for each number

Ronald J Kimball <[email protected]> Thu, 11 Mar 2004 00:56:44 -0500
Newsgroups gmane.comp.lang.perl.golf
Message-ID <[email protected]>
On Thu, Mar 11, 2004 at 04:13:01PM +1100, Andrew Savige wrote:
> I'm interested to learn the shortest Perl expression for each
> number -- but without using any numbers. Here's what I've come
> up with so far. Improvements welcome. Oh, and please feel free
> to extend the table below ($X[60] being especially juicy;-).

ord() opens up some possibilities:

> $X[5]  = $^F+$^F+!$%;
  $X[5]  = ord$^V;

> $X[6]  = $^F+$^F+$^F;
> $X[6]  = ($==~/./,$&);
  $X[6]  = $==~/./&&$&;
  $X[6]  = chr ord$=;

> $X[10] = !$%.$%;
  $X[10] = ord$/;

> $X[16] = $^F.$%-$^F-$^F;
  $X[16] = ord($:)/$^F;

> $X[25] = $^F.$^F+$^F+!$%;
  $X[25] = ord($^F)/$^F;
  $X[25] = $^F.ord$^V;

> $X[27] = $=/$^F-$^F-!$%;
  $X[27] = ord($=)/$^F;

> $X[28] = $=/$^F-$^F;
  $X[28] = ord$;;


Ronald