in reply to Re^2: (german) region code detection - request for thoughts
in thread (german) region code detection - request for thoughts
my %prefixes = ( '04025' = [ 'Region1, Region2, Region3' ], ... );
should work rather very effectively. If you have thought about this already, why do you think it would be expensive/ineffective/inadequate ?my ($pref5, $pref4, $pref3, $pref2) = map { substr( $phone, 0, $_ ) } (5, 4, 3, 2); my $prefix_length = exists $prefixes{$pref5} ? 5 : exists $prefixes{$pref4} ? 4 : exists $prefixes{$pref3} ? 3 : exists $prefixes{$pref2} ? 2 : 0 ; my $formatted_phone = join( ' ', substr( $phone, 0, $prefix_length), substr( $phone, $prefix_length), );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: (german) region code detection - request for thoughts
by Skeeve (Parson) on Aug 20, 2008 at 11:13 UTC | |
by Krambambuli (Curate) on Aug 20, 2008 at 11:27 UTC | |
by Skeeve (Parson) on Aug 20, 2008 at 15:22 UTC | |
|
Re^4: (german) region code detection - request for thoughts
by Skeeve (Parson) on Aug 20, 2008 at 16:20 UTC | |
by Krambambuli (Curate) on Aug 20, 2008 at 17:16 UTC |