write a script to check whether user enter a value is a
leap year or not?
Answer Posted / 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 |
Post New Answer View All Answers
How to add elements in a hash in perl?
What does this symbol mean '->'?
There are some duplicate entries in an array and you want to remove them. How would you do that?
What is warn function in perl?
How to access parameters passed to a subroutine in perl?
what is CPAN?
What are the different string manipulation operators in perl?
what is Perl one liner?
what are prefix dereferencer and list them out?
Explain chop?
What are the advantages of c over Perl?
how to create a flat file database as shown below s.no name age city phone 0 hema 22 Calcutta 4312542 1 hema 21 Bangalore 2344345 2 ganesh 25 delhi 2445454 3 kartik 45 pune 4312121 4 santosh 25 Hyderabad 2254231 5 kumar 25 mysore 2344567 6 gita 34 mangalore 6532123 7 gita 32 pune 2213456 Q1.print the details of the person who r from bangalore q2.Replace the city name managlore to pune q3.prints no of person having name gita and hema q4.print how many are of age 25.
explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.
What is the difference between perl array and perl hash?
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?