I would like to write an simple perl script to generate all possible words for given phone number.
I started with definition of an array:
my @nums = (
['0'],
['1'],
['2', 'a', 'b', 'c'],
['3', 'd', 'e', 'f'],
['4', 'g', 'h', 'i'],
['5', 'j', 'k', 'l'],
['6', 'm', 'n', 'o'],
['7', 'p', 'q', 'r', 's'],
['8', 't', 'u', 'v'],
['9', 'w', 'x', 'y', 'z']
);
The final script should generate following output:
$ num2word 12
12
1a
1b
1c
$ num2word 213
213
21d
21e
21f
a13
a1d
a1e
a1f
b13
b1d
b1e
b1f
c13
c1d
c1e
c1f
I am looking for any module which can do most part of the job (something like List::Permutor which does not seem to qualify for this task).
Any hints? Thanks!