M
mike
hi
i am asking for user input and the input must be an integer representing the
minutes of the hour or a string of minutes joined by a comma . For example
1) 15
2) 15,20,30
3) 15,30,40,50,59
The requirement to check are:
1) no words are allowed
2) number must be increasing order, ie. 40,34,2,59 is wrong
3) cannot end with comma ie. 40,41, is wrong
4) minutes in the range 0-59
printf "Enter minutes : " ;
my $minutes = <STDIN>; chomp($minutes);
next if $minutes =~ /\w+/;
next if $minutes =~ /\,$/;
if ( $minutes =~ /^[0-5][0-9]$/) {
print "ok\n";
last;
}
How do i check for multiple minutes separated by commas and must be increasin order?
thanks
i am asking for user input and the input must be an integer representing the
minutes of the hour or a string of minutes joined by a comma . For example
1) 15
2) 15,20,30
3) 15,30,40,50,59
The requirement to check are:
1) no words are allowed
2) number must be increasing order, ie. 40,34,2,59 is wrong
3) cannot end with comma ie. 40,41, is wrong
4) minutes in the range 0-59
printf "Enter minutes : " ;
my $minutes = <STDIN>; chomp($minutes);
next if $minutes =~ /\w+/;
next if $minutes =~ /\,$/;
if ( $minutes =~ /^[0-5][0-9]$/) {
print "ok\n";
last;
}
How do i check for multiple minutes separated by commas and must be increasin order?
thanks