write a script to check whether user enter a value is a
leap year or not?
Answer Posted / sourisengupta
#call this function by passing the year....
sub isLeapyear
{
$year=shift;
if($year%4==0){
if($year%100==0){
if($year%400==0)
return 1;
return 0;
}
return 1;
}
}
| Is This Answer Correct ? | 14 Yes | 2 No |
Post New Answer View All Answers
How can memory be managed in Perl?
how to get back up from private character editor which is saved in the format of .udf
What is the purpose of goto expr statement?
When do you use perl programming?
What is posix in perl?
Explain the difference between die and exit in perl?
Explain perl. When do you use perl for programming? What are the advantages of programming in perl?
What are the options that can be used to avoid logic errors in perl?
What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
How do I print the entire contents of an array with Perl?
Explain join function in perl?
Why is it hard to call this function: sub y { "because" } ?
What does a die() function do in perl?
There is no strict data types in perl unlike in other high level languages like Java so wouldn't that be a problem if a code in perl is to be a written by a big team of 20+ members ?"
How to prevent file truncation in perl?