0

hey guys my while loop is not working correctly..doesnt matter which character i enter it will still run the loop..and what it should do is test to see if character entered is 'y'(well thats what i want it to do )

thanks!!

```
#! /usr/bin/perl
$exp = "y";
while ($exp =="y") {
system "clear"; # clear the window
print "\nEnter the number of Widgets ordered: ";
$widgetcount = <STDIN>; #vairable to save the number of total widgerts ordered
chop $widgetcount;
print "\nEnter the number of Gidgets ordered: ";
$gidgetcount = <STDIN>; #vairable to save total number of gidget ordered
chop $gidgetcount;
print "\nEnter the number of Gadgets ordered: ";
$gadgetcount = <STDIN>; #variablet to save total number of gadget ordered
chop $gadgetcount;
print "\nEnter the number of Doodats ordered: ";
$doodatcount = <STDIN>; #vatiable to save total number of doodats ordered
chop $doodatcount;
$widgetsub = $widgetcount * 10.25; #subtotal of widgets
"assignment4.pl" 67L, 2442C written
[cs41s1004@cc-ccs assignments]$ vi assignment4.pl
#! /usr
/bin/perl
$exp = "y";
while ($exp =="y") {
system "clear"; # clear the window
print "\nEnter the number of Widgets ordered: ";
$widgetcount = <STDIN>; #vairable to save the number of total widgerts ordered
chop $widgetcount;
print "\nEnter the number of Gidgets ordered: ";
$gidgetcount = <STDIN>; #vairable to save total number of gidget ordered
chop $gidgetcount;
print "\nEnter the number of Gadgets ordered: ";
$gadgetcount = <STDIN>; #variablet to save total number of gadget ordered
chop $gadgetcount;
print "\nEnter the number of Doodats ordered: ";
$doodatcount = <STDIN>; #vatiable to save total number of doodats ordered
chop $doodatcount;
$widgetsub = $widgetcount * 10.25; #subtotal of widgets
$widgetsub = sprintf("%0.2f", $widgetsub); #setprecesion two decimal places
print ("\nThe total number of Widgets ordered is: $widgetcount");
print ("\nThe total value of Widgets ordered is \$$widgetsub\n");
$gidgetsub = $gidgetcount * 5.75; #subtotal of gidgets
$gidgetsub = sprintf("%0.2f", $gidgetsub); #setprecesion two decimal places
print ("\nThe total number of Gidgets ordered is: $gidgetcount");
print ("\nThe total value of Gidgets ordered is \$$gidgetsub\n");
$gadgetsub = $gadgetcount * 11.33; #subtoal of gadgets
$gadgetsub = sprintf("%0.2f",$gadgetsub); #setprecesion two decimal places
print ("\nThe total number of Gadgets ordered is: $gadgetcount");
print ("\nThe total value of Gadgets ordered is \$$gadgetsub\n");
$doodatsub = $doodatcount * 44.75; #subtotal of doodats
$doodatsub =sprintf("%0.2f",$doodatsub); #setprecesion two decimal places
print ("\nThe total number of doodats ordered is: $doodatcount");
print ("\nThe total value of doodats ordered is \$$doodatsub\n");
#total of all subtotals without taxes and shipping charges
$total=($widgetsub + $gidgetsub + $gadgetsub + $doodatsub);
$total = sprintf("%0.2f", $total);
print ("\nTotal of all products subtotal is \$$total ");
$tax = $total*.10; #total tax on total amount
$tax =sprintf("%0.2f", $tax);
print ("\nThe total of all products tax is \$$tax");
$shipping = $total*.085; #total shipping charges
$shipping = sprintf("%0.2f", $shipping);
print ("\nThe total of all products shipping charges is \$$shipping");
$grandtotal = $total + $tax + $shipping; #grandtotal
$grandtotal = sprintf("%0.2f", $grandtotal);
print("\nThe grandtotal is \$$grandtotal \n");
print "Please enter 0 to quit: ";
$exp = <STDIN>;
chop $ex;
}
```