|Welcome to the Monastery|
Using Number Ranges in a Dispatch Tableby planetscape (Chancellor)
|on Feb 18, 2012 at 18:35 UTC||Need Help??|
planetscape has asked for the
wisdom of the Perl Monks concerning the following question:
Happy Weekend, Esteemed Monks!
I had several distinct values, which I placed first in my dispatch table, and modifying the sample code to include multiple ranges seemed straightforward enough:
That worked. But I got a surprise when I added another separate range following the first:
Data in the range 89930 to 89999 still apparently triggered the action_124_to_140 sub!
I went back and actually ran xdg's code, with the addition of this line at the end:
And to my surprise, it suffers from a similar bug/fault/something:
C:\Users\Nancy\Documents>perl 568142.pl Zero 1 to 999 1 to 999
(That last line really should be "1e3"...)
My test program:
And its output:
C:\Users\Nancy\Documents>perl test_Dispatch_Table_for_PM.pl 01 Geographic Numbers "1" does not exist in the dispatch table! "56" does not exist in the dispatch table! "55" does not exist in the dispatch table! 055 Corporate Numbers 124 Range 124 to 140, plus ... "0124" does not exist in the dispatch table! "0140" does not exist in the dispatch table! 140 Range 124 to 140, plus ... 145 Range 124 to 140, plus ... 89930 Range 124 to 140, plus ... 89999 Range 124 to 140, plus ... 89963 Range 124 to 140, plus ...
(Last three lines really should be "Range 89930 to 89999"...)
Dear Monks, please tell me how I can modify this code to permit multiple number ranges, or if I can get it to work as desired at all, or if I need another approach...
Thanks in advance!