Skip to content

Instantly share code, notes, and snippets.

@dagolden
Created July 18, 2010 01:38
Show Gist options
  • Save dagolden/480030 to your computer and use it in GitHub Desktop.
Save dagolden/480030 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use 5.010;
my @num2chars=split ':', '::abc:def:ghi:jkl:mno:prs:tuv:wxy';
say "Enter a seven-digit phone number:";
my $regex = join q{}, map { "[$num2chars[$_]]" } split //, <STDIN>, 7;
open my $dict, 'C:\Scripts\wordlist.txt' or die $!;
while ( my $line = uc <$dict> ) { say($line), last if $line =~ /^$regex$/i }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment