[prog] Perlish

kansas_kennedy at phreaker.net kansas_kennedy at phreaker.net
Fri Oct 25 03:47:50 EST 2002


Hi group,

I am new to Perl. I have written this program which basically deals with your 
age, how many years you'd be sleeping in your entire life-time etc. etc.

The code is given below and the program is attached.

Please review the code and let me know if it lacks anything.

JAPH,
Kenny.

Code:
~~~~~~
#!/usr/bin/perl -w
print "How many hours do you sleep everyday\n";
chomp ($sleep = <stdin>);
$hours = 365*$sleep;
$days = $hours/24;
$workingdays = 365 - $days;
print "Wow! you sleep $hours hours a year, which equals to $days days a year 
in total\n";
print "You have $workingdays workingdays in one year!!!\n";
print "And how long do you expect to live?\n";
chomp ($live = <stdin>);
$sleepyears = $live*$days;
$x = $sleepyears/365;
print "you'd be sleeping $x years of your entire life-time\n";
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sleep.pl
Type: text/x-perl
Size: 495 bytes
Desc: not available
Url : http://linuxchix.org/pipermail/programming/attachments/20021025/650a1336/sleep.bin


More information about the Programming mailing list