this is a perl program that will tell you 
what your phone number spells.

remember some digits are better then others.
the digits one and zero dont have any letters
so execpt in odd cases they dont spell anything.

a lot of people have numbers that spell stuff
and dont even know it. 


well here is the perl code.  

remove the 1st line if your not on
a unix box. its a unix command that tells
the shell to run the perl program using
the perl program in /use/bin/perl.


#!/usr/bin/perl #this program must run on perl5 or higher #i dont think perl4 supports dynamic variables if ( $#ARGV == -1 ) { print STDOUT "usage\n"; print STDOUT "$0 number1 [number2 number3 ...]\n"; print STDOUT "the program prints out all the spellings of the phone number entered\n"; print "usage\n"; print STDOUT "$0 4868\n"; print "$0 number1 [number2 number3 ...]\n"; print "the program prints out all the spellings of the phone number entered\n"; exit 1; } # # process each number passed to the command line # for $_ (@ARGV) { $number=$_; # # print the number we are spelling # print "Number($number)\n"; # #if the number contains any letters #convert them to the correct digit #note Q - becomes 7 #and Z - becomes 9 #and after converting delete anything #that is not a number if ( ! /^[0-9]+$/ ) { s/[abc]/2/gi; s/[def]/3/gi; s/[ghi]/4/gi; s/[jkl]/5/gi; s/[mno]/6/gi; s/[pqrs]/7/gi; s/[tuv]/8/gi; s/[wxyz]/9/gi; # #at this point all valid characters have #been converted to numbers #delete any characters that are left that #aint numbers s/[^0-9]//gi; # #tell them what we converted the number to # print "Processed as($_)\n"; } # #so we can be lazy convert the number from a number like # 5467 #to a list of numbers delimited by commas #and then delete the last comma s/./$&,/g; # 5467 -> 5,4,6,7, s/,$//; # 5,4,6,7, -> 5,4,6,7 # # convert the numbers into a list or an array # if we hardcoded it would look like this # @nums=(5,4,6,7); # @nums=split(","); # #call the phone speller program which is #named recur because it recursively calls it self # # arg1 - this is the number like 7 which is to be converted # to letters 7 -> p, r , s # arg2 - this is the digit number were processing # 0 is the 1st digit # 1 is the 2nd digit # 2 is the 3rd digit and so on # arg3 - this is the number of digits in the phone number # were processing minus one. # C and perl programmers like to think in terms as # relative to zero instead of relative to one &recur($nums[0],0,$#nums); } exit 0; sub recur { # # use my to make these variables dynamic. # if they are static the program will choke my $j=0; my $y; my $l; my $start=0; # # if the current digit is either zero or one # only generate one set of letters for it # because zero and one dont have any letters # the only way they can be represented is as # either 1 or 0 # if ($_[0] <= 1 ) { $start=2; } # #generate all 3 possible digits for this number # #for ($j=0;$j<3;$j++) for ($j=$start;$j<3;$j++) { # #call function getdigit to get the next digit #and stick it on the array # $array[$_[1]]=&getdigit($_[0],$j); #print ($_[1]," ",@array,"\n"); if ($_[1] < $_[2]) { # #recursive get the next numbers digit # $y=$_[1]+1; &recur($nums[$y],$y,$#nums); } else { # # after losts of work we have gotten the last digit of # this number print it. # for($l=0;$l<=$#array;$l++) { print "$array[$l]"; } print "\n"; # # end the recursive calls only after the last digit is processed # these 3 lines are not required, but i have not bothered to # see if it reduces processing time. # if ($j == 2 ) { return; } } } } sub getdigit { #this table defines what #letters are associated with each number #some numbers dont have any letters like 0 and 1 # my @table=((0,0,0),(1,1,1), ("a","b","c"), ("d","e","f"), ("g","h","i"), ("j","k","l"), ("m","n","o"), ("p","r","s"), ("t","u","v"), ("w","x","y") ); my $num=$_[0]; # grab the telephone number my $sub=$_[1]; # get the offset letter number # like for the number 2 if # the offset is 0 - a is returned # 1 - b is returned # 2 - c is returned my $zsub; # #verify mikes logic is not on drugs #subscript must be 0 to 2 and not #as paul putz would say horseshit like 1.4 # if ($sub < 0 || $sub > 2 || $sub!~/^\d$/ || ! ($sub=~/^[0-9]$/ )) { print STDERR "logic error getdigit needs subscript 0 to 2 we have \"$sub\"\n"; exit 1; } # # number must be 0 - 9 # nada mas # if ($num < 0 || $num > 9 || ! ($num=~/^[0-9]$/ )) { print STDERR "logic error getdigit needs telephone number 0 to 9 we have \"$num\"\n"; exit 1; } $zsub=($num*3)+$sub; #print ($num," ",$sub," ",($num*3)+$sub," ",$zsub," ",$table[$zsub],"\n"); return $table[$zsub]; }

Visit the Crazy Atheist Libertarian
Visit my atheist friends at Arizona Secular Humanists
Some strange but true news about the government
Some strange but real news about religion
Interesting, funny but otherwise useless news!