After seeing a number of posts suggesting using a regex to accomplish this task, i am left a bit surprised. It seems to me that in terms of program speed, doing a couple numeric comparisons will be faster than a regex or two. This problem itself is somewhat trivial, but in general i see a lot of regex solutions here at perlmonks, which seem to be for the sake of terse code, but will probably take longer to execute in general than other alternatives.