if pass the values to check_time like this its getting different values:
-
use Date::Calc qw(:all);
-
-
$hh="jjjjjjjjjjjjjjjjj";
-
-
$mm="bnsdgs";
-
-
$ss="kdhhgfdfdh";
-
-
if(check_time($hh,$mm,$ss))
-
{
-
print "valid time:";
-
-
}
-
else
-
-
{
-
print "Inva;id time";
-
-
}
-
here i am getting the valid time as output..
please tell me the reason..
thank u,
Manogna..........
I am not really sure why. What version of Perl are you using and what OS are you working on?
Here is the code I used (only slight modification for using the two pragmas you should have already been using, plus their issues resolution(s)):
-
use strict;
-
use warnings;
-
-
use Date::Calc qw(:all);
-
-
my $hh="jjjjjjjjjjjjjjjjj";
-
-
my $mm="bnsdgs";
-
-
my $ss="kdhhgfdfdh";
-
-
if(check_time($hh,$mm,$ss))
-
{
-
print "valid time:";
-
}
-
else
-
{
-
print "Inva;id time";
-
-
}
-
And here is what was output when I ran the script:
-
C:\coding\perl>perl Perl-2.pl
-
Argument "jjjjjjjjjjjjjjjjj" isn't numeric in subroutine entry at Perl-2.pl line
-
12.
-
Argument "bnsdgs" isn't numeric in subroutine entry at Perl-2.pl line 12.
-
Argument "kdhhgfdfdh" isn't numeric in subroutine entry at Perl-2.pl line 12.
-
valid time:
-
To me, this is more like what should have been output. You should have not gotten as far as you say you did.
Regards,
Jeff