in reply to Re: Please Help! This is a class assignment given to me.
in thread Please Help! This is a class assignment given to me.
my $A = 250; # Pizza price my $B = 300; # Selling price my $C = $B - $A; # Difference print "A = $A \n B = $B \n C = $C \n";
Good news - Perl actually allows variable names with more than one character in them. This means that you no longer have to remember what $B is supposed to represent. Instead you can give that variable a meaningful name.
my $cost_price = 250; my $sale_price = 300; my $profit = $sale_price - $cost_price; print "Make them for $cost_price\nSell them for $sale_price\nMake $pro +fit on each\n";
Addendum: There is, as with most things, a happy medium.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Please Help! This is a class assignment given to me.
by BillKSmith (Monsignor) on Dec 07, 2019 at 15:46 UTC |