Learn PERL Basic with Me : PERL Script and mathematical functions

Last post was about a PERL script that can acts as a miles to Km converter. We found that we can perform the mathematical function with help of PERL scripts. We can perform addition, substraction,division and many more mathematical function with the help of PERL.

Solution of PERL EXCERCISE 1 : Hour to minutes converter

#!/usr/local/bin/perl
 
# convert hours into minutes
 
print "Please Enter the value in hours: ";
 
$hour = ;
 
# 1 hour = 60 minutess
 
$minute = $hour * 60;
  
print "Result: $minute minutes \n";
How to save perl script HERE

Solution of PERL EXCERCISE 1 : day to hours converter

#!/usr/local/bin/perl
 
#!/usr/local/bin/perl
 
# convert days into hours
 
print "Please Enter the value in days: ";
 
$day = ;
 
# 1 day = 24 hour
 
$hour = $day * 24;
  
print "Result: $hour hours \n";

No comments:

Post a Comment

Have Problem ?? Drop a comments here!