2012/2/23 Rob Dixon <[email protected]>
>
> Negative numbers aside, it seems more straightforward to insist that
> there are no non-digit numbers in the input, hence
>
That's definitely an option, but I'm not in favor of 'double negation'
conditionals usually, as they might be confusing.
For example, I use <unless> only when its question is simple and... a kind
of predictable. Like that:
exit unless $result =~ /^[0-9]+$/
That's definitely an overkill for me:
unless ($result !~ /[^0-9]/) { ... }
...especially because it can be safely turned to ...
if ($result =~ /[^0-9]/) { ... }
As for /\D/, well, I'd prefer to use it only with /a modifier, the reasons
discussed earlier at this thread. )
-- iD