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!


--
"Language shapes the way we think, and determines what we can think about."
-- B. L. Whorf

Replies are listed 'Best First'.
Re^3: Phone number to word conversion
by JavaFan (Canon) on Nov 12, 2010 at 07:34 UTC
    Incidentally, Perl complains about your "abuse" of $_:
    Not if you upgrade away from your old 5.10.0. Even an upgrade to 5.10.1 will fix that issue for you.