Shortest non-numeric Perl expression for each number
Andrew Savige <[email protected]> Thu, 11 Mar 2004 16:13:01 +1100 (EST)
| Newsgroups | gmane.comp.lang.perl.golf |
|---|---|
| Message-ID | <[email protected]> |
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;-).
BTW, $= is my favourite Perl built-in variable. What's yours?
/-\
$X[0] = $%;
$X[1] = !$%;
$X[2] = $^F;
$X[3] = $^F+!$%;
$X[4] = $^F+$^F;
$X[5] = $^F+$^F+!$%;
$X[6] = $^F+$^F+$^F;
$X[6] = ($==~/./,$&);
$X[7] = $=>>$^F+!$%;
$X[8] = !$%.$%-$^F;
$X[9] = !$%.$%-!$%;
$X[10] = !$%.$%;
$X[11] = !$%.!$%;
$X[11] = !$%x$^F;
$X[12] = !$%.$^F;
$X[13] = !$%.$^F+!$%;
$X[14] = !$%.$^F+$^F;
$X[15] = $=>>$^F;
$X[16] = $^F.$%-$^F-$^F;
$X[17] = $^F.$%-$^F-!$%;
$X[18] = $^F.$%-$^F;
$X[19] = $^F.$%-!$%;
$X[20] = $^F.$%;
$X[21] = $^F.!$%;
$X[22] = $^F.$^F;
$X[23] = $^F.$^F+!$%;
$X[24] = $^F.$^F+$^F;
$X[25] = $^F.$^F+$^F+!$%;
$X[26] = $=/$^F-$^F-$^F;
$X[27] = $=/$^F-$^F-!$%;
$X[28] = $=/$^F-$^F;
$X[29] = $=/$^F-!$%;
$X[30] = $=/$^F;
for my $i (0..$#X) {
print "$i $X[$i]\n";
$i == $X[$i] or warn "oops!\n";
}
Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com