in reply to Re: Phone number to word conversion
in thread Phone number to word conversion
Sweet!!! I just love this:
my @c; for (my $i = 0; $i < length; $i++) { for (my $j = 2; $i + $j <= length; $j++) { push @c, substr $_, $i, $j; } }
*Very* pretty - thank you so much! Exactly the kind of thing I was asking for.
Incidentally, Perl complains about your "abuse" of $_:
Attempt to free unreferenced scalar: SV 0x9730848, Perl interpreter: 0 +x970a008 at /tmp/perm2 line 17, <DATA> line 1.
but that's easily fixed. Again, thank you - that's a really nifty way to build that permutation list!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Phone number to word conversion
by JavaFan (Canon) on Nov 12, 2010 at 07:34 UTC |