See http://www.perl.com/doc/manual/html/pod/perlop.html
Yaron Kahanovitch ----- Original Message ----- From: "Ryan Dillinger" <[EMAIL PROTECTED]> To: beginners@perl.org Sent: 21:06:55 (GMT+0200) Africa/Harare יום ראשון 29 יולי 2007 Subject: Precedence? Hello, I have written this script. I have a good understanding of all but line: $return = ($end - $start) / $start * 100; If I start with 1000, and end with say..900 or vise versa. You subtract first then? Thank You for your help! #!/usr/bin/perl use warnings; $start = 0; $end = 0; $return = 0; while () { print 'Enter the starting price '; chomp($start = <STDIN>); print 'Enter the current price '; chomp($end = <STDIN>); if ($start eq '' or $end eq '') { print "Either the purchase or the current price is missing\n"; next; } if ($start =~ /\D/ or $end =~ /\D/) { if ($start =~ /\// or $end /\//) { print "Enter prices as decimal numbers.\n"; next; } } last; } $return = ($end - $start) / $start * 100; if ($start > $end) { print "Your investment has lost money\n"; }elsif ($start < $end) { print "Your investment has made money\n"; }else{ print "Your investment lost money\n"; } print "Your return on your money is: "; printf("%.1f%%\n", $return); _________________________________________________________________ Don't get caught with egg on your face. Play Chicktionary!� http://club.live.com/chicktionary.aspx?icid=chick_hotmailtextlink2 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/