write a script to check whether user enter a value is a
leap year or not?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / subhash chandran
#The logic is that the year is either divisible by both
100 and 4 , OR its only divisible by 4 not by hundred
if($Year%400 == 0 || ($Year%100 != 0 && $Year%4 == 0))
{
print "Leap year \n";
}
else
{
print "Not Leap \n";
}
| Is This Answer Correct ? | 8 Yes | 0 No |
Answer / 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 ? | 7 Yes | 2 No |
What is the difference between use and require in perl?
Explain perl. When do you use perl for programming? What are the advantages of programming in perl?
What is lexical variable in perl?
what is the meaning of rigging?
For a situation in programming, how can you determine that Perl is a suitable?
what is the function that is used to identify how many characters are there in a string?
What is use of ‘->’ symbol?
i have a folder called 'error' and in that, i have error log files which are generated by the build, now i want to findout the string 'error' from each log file and that error has to be copied into the another file called 'analysis'. how do you do this in perl?
Mention the difference between die and exit in Perl?
Is there any way to add two arrays together?
Comment on the scope of variables in perl.
How do I send e-mail from a Perl/CGI program on a Unix system?