in reply to Incrementing strings revisited: What do i miss? [SOLVED]
Update2: Reset state to UNSOLVED
Why?
Anyway, I think what's confusing, at least to me, is that B=0; and I find what soonix said above is key (emphasis mine): "Counting B ... Z (without A) is like counting 1 ... 9 (without 0)."
How about this:
use feature 'state'; use Math::Fleximal; sub getnext { state $num = Math::Fleximal->new("A", [qw/A B C D F G H J K L M N P Q R S T V X Y Z/]); do { $num=$num->add("B") } until $num->to_str!~/A/; return $num->to_str; } print getnext."\n" for 1 .. 1000; __END__ B C D ... Y Z BB BC BD ... ZY ZZ BBB BBC ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Incrementing strings revisited: What do i miss?
by karlgoethebier (Abbot) on Feb 14, 2015 at 11:10 UTC |