Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Created November 30, 2014 19:47
Show Gist options
  • Select an option

  • Save nikAizuddin/58f06ed89c559244a7fe to your computer and use it in GitHub Desktop.

Select an option

Save nikAizuddin/58f06ed89c559244a7fe to your computer and use it in GitHub Desktop.
BCN2053 Operating System Lab Sheet 6 (PERL)
#!/bin/perl
# ==========================================================
# This script requires user to input the weight
# of the lettuce. The output of the script
# will display the total amount of price base
# on the weight (Assume that 1kg is RM2.50).
#
# Sample output will be:
#
# Enter the weight of lettuce in KG
# [User input]
# Total price is RM[Result]
# Please pay at the counter
#
# Round your answer in 2 dotted decimal.
# ==========================================================
printf("Enter the weight of lettuce in KG\n");
$weight = <STDIN>;
$total = $weight * 2.50;
printf("Total price is RM%.2f\n", $total);
printf("Please pay at the counter\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment