Perl Programming with Mapping

 
use strict;
print "Enter last 4 digits of phone number:";
chomp(my $number=<>);
die "Invalid number: '$number'\n" unless $number=~/^\d{4}$/;
my @d=split(undef,$number);
my %map={
2=>"[abc]",
3=>"[def]",
4=>"[ghi]",
5=>"[jkl]",
6=>"[mno]",
7=>"[pqrs]",
8=>"[tuv]",
9=>"[wxyz]",
};
my $r=$map{$d[0]}.$map{$d[1]}.$map{$d[2]}.$map{$d[3]};
open FILE,"</usr/share/dict/words";
my $x=0;
while(<FILE>){
        chomp;
        if($_=~/^$r$/){
                print "$_\n";
        }
        $x++;
}

This program is suppose to construct a regular expression mapping the letters to character classes then search the file for matching words to find what the last four digits of a phone number may spell.

My problem is that it is not giving me any output.

Any help would be greatly appreciated.

Your first error: you didn't use warnings;
Next up, split expect a regular expression as it's first parameter, so if you want to split on the space between characters, use '//' instead of undef.
The regex you're building, by itself, is ok. But you're trying to match it anchored at the beginning and the end of the word, which means it will only ever return 4 character long words. I don't know if that's what you want, but is severely limits available results.

And I'd suggest an additional check / error correction, in case someone inputs a '1' as one of the digits, as that'll throw an unsightly "uninitialized value" error.