#!/usr/bin/perl use strict; use warnings; # 1149595 print "Enter number of days (1..90, no fractions or negative values): "; my $days = ; chomp $days; # if ($days =~ /^\s*1-90-9*\s*$/) { # the numeric "test" is hopelessly wrong # the "^\s* allows user to enter leading spaces # regex permits a trailing space to match despite the chomp # ....BUT, a regex is probably the wrong way to go... #if (0 < $days && $days <= 90 && $days =~ /^\d\d$/ ) { # makes the exact test explicit if ( (0 < $days) && ($days <= 90) && ($days =~ /^\d\d$/) ) { # some may prefer this print "Inside if, satisfied the spec: $days \n\n"; } else { print "Days entered do not meet spec: $days \n\n"; # tell the user specificly }