Hello - I am new to Perl, and looking for some much needed direction.

I am trying to get a basic formula in place (within an existing IF
statement) that will serve to increase my price (i.e., "$new_price")
by the following formula:

=PRICE divided by 0.8  plus 15

In other words, if the Price is equal to 3, the results of the
$new_price should be 18.75.  And if the price is equal to 5, then the
$new_price should be equal to 21.25.

The script that I am trying to alter  is shown below. Can someone
possibly let me know how I can alter the below script (which I believe
would mean to alter the line that reads $new_price = $o_list[2]-
>{price};) so that the new price would would work as described above?
Also, just a layman's explanation of the syntax shown below would be
greatly helpful.  I am trying to understand what the "-=" and the "->"
and the "?" characters represent.

Thanks for any suggestions or guidance.

#
if ( @o_list ) {
 if ( defined ( $o_list[2] ) ) {
 $new_price = $o_list[2]->{price};
 $new_price -= $new_price <= 0 ? $new_price - .01 : 0;
 }
}


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to