in reply to No such file or directory error
if ($num =~ /1-9/)
Unless you want to check whether $num contains the string '1-9', it will do not what you want, which is probably to check whether $num only contains the figures 1 to 9:
But watch out! The figure 10 will not be accepted by this. Why don't you just do:if ($num =~ /^[1-9]+$/)
for whatever the acceptable minimum and maximum values are.if ($num >= $minimum and $num <= $maximum and int($num) == $num) { ... + }
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial Deltronics
|
|---|